--I don't think you read carefully everything I said.
No I try to but sorry please explain
You propose a few questions about nonstatic member functions. What I'm
saying is that there is no reason for these questions to be
specifically about nonstatic member function. These questions can/
should be asked about all functions the same. There is nothing about
nonstatic member functions that makes a difference with respect to
these questions.
The difference between nonstatic member functions and other functions
is in syntax and some name lookups:
call syntax:
arg0.foo( arg1, arg2 );
instead of:
foo( arg0, arg1, arg2 );
declaration syntax:
Ret Par0::foo( Par1 arg1, Par2 arg2 );
instead of:
Ret foo( Par0& arg0, Par1 arg1, Par2 arg2);
And because it's not possible by the syntax to give a name for arg0,
use a keyword 'this', which could be a reference, but was decided to
be the equivalent const pointer to the object.
So as if the function begins with:
Par0* const this = &arg0;
* Except that a temporary can bind to a hipothetic non const reference
arg0. But nobody in this thread was talking about the temporaries
difference.
Note that:
arg0->foo( arg1, arg2 );
is equivalent to:
(*arg0).foo( arg1, arg2 );
To assure some terminology:
A function of arity N, has N parameters (in CS sense). Non-static
member function, can only be of arity 1 or bigger, and their first
parameter/argument is written before the fucntion identifier (instead
of inside the braces, both declaration and call).
Now I'll show how a few of the questions could be frased in the more
general sense of functions, instead of only nonstatic member
functions:
1)
From Shaub's post:
It is undefined behavior if you do so.
struct A { void f() { } };
int main() { ((A*)0)->f(); }
struct A {};
void foo( A& );
int main() { foo( *((A*)0) ); }
This is undefined behaviour for the same reason. It has nothing
specific to do with it being a nonstatic member function.
2)
Your first question
Is it legal to invoke a (non static) member function without an object?
can be refrased:
Is it legal to invoke a function with a reference parameter without an
object?
3) and the grand final:
It follows that if an object(or derived object) does not exist then it is
undefined behaviour to call its respective nonstatic member function?
Therefore it must be true that a member function does not exist without an
object.
It follows that if an object(or derived object) does not exist then it
is
undefined behaviour pass it to a reference parameter of any function?
Therefore it must be true that a function with reference parameter
does not exist without an
object (for that parameter).
itaj