Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg From: rfg@ICS.UCI.EDU Newsgroups: gnu.g++.bug Subject: BUG in G++ 1.36.1 - no error on non-ptr return from operator->() Message-ID: <8912091628.aa20121@ICS.UCI.EDU> Date: 10 Dec 89 00:28:09 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 31 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! }