Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg From: rfg@MCC.COM (Ron Guilmette) Newsgroups: gnu.g++.bug Subject: BUG in G++ 1.34.1 Message-ID: <8903302330.AA02658@riunite.aca.mcc.com> Date: 30 Mar 89 23:30:36 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 51 The following program contains apparently legal code, but g++ 1.34.1 (on a Sun3) rejects it with compile-time errors. ---------------------------------------------------------------------- // Check that it is legal to take the address of an overloaded // operator (which is class-name-qualified), even if that operator // could be either a unary or a binary operator, so long as the // operator designator is unambiguous when class-name-qualified // (i.e. only one form is declared for the class). // // Note that the & operator may be applied to unambiguous qualified // method names. It seems that this privledge should extend likewise // to unambigous qualified operator designators. #include "Testinc.h" class base { int field; public: int operator+ (base b); int operator- (); }; int test () { &base::operator+; // compile-time error using g++ 1.34.1 &base::operator-; // compile-time error using g++ 1.34.1 return 0; } int base::operator+ (base b) { b.field = 7; return 0; } int base::operator- () { return 0; } ------------------------------------------------------------------------ g++ -Wall -Wwrite-strings -v -S a023.C g++ version 1.34.1.1 /usr/local/src/lib/sun3/g++-1.34.1.1/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wall -D__HAVE_68881__ -Dmc68020 a023.C /tmp/cca02641.cpp GNU CPP version 1.34.1.1 /usr/local/src/lib/sun3/g++-1.34.1.1/gcc-c++ /tmp/cca02641.cpp -quiet -dumpbase a023.C -Wall -Wwrite-strings -noreg -version -o a023.s GNU C++ version 1.34.1.1 (68k, MIT syntax) compiled by GNU C version 1.33. In function int test (): a023.C:22: invalid lvalue in unary `&' a023.C:23: invalid lvalue in unary `&'