Article View: gnu.g++.bug
Article #1944BUG in G++ 1.35-.0- (b062)
From: Ron Guilmette
Date: Thu, 04 May 1989 15:38
Date: Thu, 04 May 1989 15:38
86 lines
4225 bytes
4225 bytes
In the following source file, errors are not properly flagged for attempts
to give default arguments within (unary) operator declaration formal argument
lists. Also, a "syntax error" *is* reported for (apparently) no reason.
b062 had missed error(s) as follows:
14: int operator + (st st1 = st_object); // ERROR
17: int operator - (st st1 = st_object); // ERROR
20: int operator & (st st1 = st_object); // ERROR
23: int operator * (st st1 = st_object); // ERROR
25: int operator ~ (st st1 = st_object); // ERROR
27: int operator ! (st st1 = st_object); // ERROR
29: int operator ++ (st st1 = st_object); // ERROR
31: int operator -- (st st1 = st_object); // ERROR
33: int operator ( ) (st st1 = st_object); // ERROR
b062: FAILED
--------------------------------------------------------------------------
// Check that it is illegal to declare unary operators with
// a default value for the formal argument. Check type
// conversions as well as normal operators.
struct st {
int member;
};
st st_object;
int int_object;
void* voidp_object;
// Unary + could be binary
int operator + (st st1 = st_object); // ERROR
// unary - could be binary
int operator - (st st1 = st_object); // ERROR
// unary & could be binary
int operator & (st st1 = st_object); // ERROR
// unary * could be binary
int operator * (st st1 = st_object); // ERROR
int operator ~ (st st1 = st_object); // ERROR
int operator ! (st st1 = st_object); // ERROR
int operator ++ (st st1 = st_object); // ERROR
int operator -- (st st1 = st_object); // ERROR
int operator ( ) (st st1 = st_object); // ERROR
int operator -> (st st1 = st_object); // ERROR
void* operator new (int size = int_object); // ERROR
void operator delete (void* voidp_arg = voidp_object); // ERROR
int operator int (st st1 = st_object); // ERROR
st operator st (st st1 = st_object); // ERROR
--------------------------------------------------------------------------
g++-new -Wall -Wwrite-strings -g -S -v b062.C
g++ version 1.35.0-.0
/usr/local/src/lib/sun3/g++-1.35-.0-.0/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wall -D__HAVE_68881__ -Dmc68020 b062.C /tmp/cca22937.cpp
GNU CPP version 1.35.0-.0
/usr/local/src/lib/sun3/g++-1.35-.0-.0/gcc-c++ /tmp/cca22937.cpp -quiet -dumpbase b062.C -Wall -Wwrite-strings -noreg -version -G -o b062.s
GNU C++ version 1.35.0-.0 (68k, MIT syntax) compiled by GNU C version 1.34.1.
b062.C:35: parse error before `st'
b062.C:35: aggregate value used where an integer was expected
b062.C:35: parse error before `)'
b062.C:37: operator has no user-defined argument type
b062.C:37: conflicting types for `void *__builtin_new (int (= int_object ))'
(null):0: previous declaration of `void *__builtin_new (long int)'
b062.C:39: operator has no user-defined argument type
b062.C:41: operator <typename> requires empty parameter list
b062.C:43: operator <typename> requires empty parameter list
b062.C:33: warning: `int operator () (struct st (= st_object ))' defined but not used
b062.C:31: warning: `int operator -- (struct st (= st_object ))' defined but not used
b062.C:29: warning: `int operator ++ (struct st (= st_object ))' defined but not used
b062.C:27: warning: `int operator ! (struct st (= st_object ))' defined but not used
b062.C:25: warning: `int operator ~ (struct st (= st_object ))' defined but not used
b062.C:23: warning: `int operator (unary *) (struct st (= st_object ))' defined but not used
b062.C:20: warning: `int operator (unary &) (struct st (= st_object ))' defined but not used
b062.C:17: warning: `int operator - (struct st (= st_object ))' defined but not used
b062.C:14: warning: `int operator (unary +) (struct st (= st_object ))' defined but not used
Technical Details
Message-ID:
<8905041538.AA22967@riunite.aca.mcc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfgShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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.35-.0- (b062) Message-ID: <8905041538.AA22967@riunite.aca.mcc.com> Date: 4 May 89 15:38:51 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 86