Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Ron Guilmette
Thu, 30 Mar 1989 23:30
BUG in G++ 1.34.1
Author: Ron Guilmette
Date: Thu, 30 Mar 1989 23:30
Date: Thu, 30 Mar 1989 23:30
51 lines
2114 bytes
2114 bytes
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 `&'
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads