rfg@ICS.UCI.EDU (12/10/89)
The language rules say that you cannot return non-pointer
values from operator->. So why does G++ (1.36.1) wait until
it sees some *use* of a blatantly bogus declaration of an operator->
before it flags an error?
// rfg
struct c1 {
int f1;
int f2;
c1 ();
int get_f1 () { return f1; }
};
struct c2 {
c1 c1_member;
c1 & operator -> () { return c1_member; } // should get an error here!
};
int
main ()
{
c2 c2_object;
int i;
i = c2_object->get_f1 (); // actually gets an error here!
i = c2_object->f1; // actually gets an error here!
}