Path: utzoo!utgpu!watmath!iuvax!purdue!tut.cis.ohio-state.edu!YAHI.STANFORD.EDU!tiemann From: tiemann@YAHI.STANFORD.EDU (Michael Tiemann) Newsgroups: gnu.g++.bug Subject: BUG in G++ 1.35.0 (a036) Message-ID: <8907282210.AA29861@yahi.Stanford.EDU> Date: 28 Jul 89 22:10:53 GMT References: <8906082212.AA11343@pink.aca.mcc.com> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@lurch.stanford.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 51 Date: Thu, 8 Jun 89 17:12:15 CDT From: rfg@mcc.com (Ron Guilmette) Posted-Date: Thu, 8 Jun 89 17:12:15 CDT Using G++ 1.35.0/Sun3, the following code gets the errors shown below the code. If the definition of "function" is moved to a point *below* the declaration of the class "base", the errors go away. ----------------------------------------------------------------- // Check that a global level function which has already been // either declared or defines may subsequently be declared // to also be a friend of some class. // // This generates an error in G++ 1.35.0 int function (int i, int j) { return i + j; } struct base { int member; friend int function (int, int); }; int main () { return 0; } ------------------------------------------------------------------- g++-1.35.0.0 -g -Wall -Wwrite-strings -v -S a036.C g++ version 1.35.0 /usr/local/src/lib/sun3/g++-1.35.0.0/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wall -D__HAVE_68881__ -Dmc68020 a036.C /tmp/cca11336.cpp GNU CPP version 1.35 /usr/local/src/lib/sun3/g++-1.35.0.0/gcc-cc1plus /tmp/cca11336.cpp -quiet -dumpbase a036.C -Wall -Wwrite-strings -noreg -version -G -o a036.s GNU C++ version 1.35.0 (68k, MIT syntax) compiled by GNU C version 1.35. a036.C:16: friend `function' implicitly overloaded a036.C:9: after declaration of non-overloaded `int function (int, int)' a036.C:16: warning: `int function (int, int)' declared but never defined There is a switch `NO_AUTO_OVERLOAD' which is presently #defined in cplus-tree.h. If you want C++ 2.0's automatic overloading of all functions defined in C++ scope, comment out this #define. It will probably be commented out when 1.36.0 makes the scene. Michael