Article View: gnu.g++.bug
Article #1895BUG in G++ 1.35.0 (pre-release) void& formals allowed
From: Ron Guilmette
Date: Sat, 22 Apr 1989 18:16
Date: Sat, 22 Apr 1989 18:16
51 lines
2599 bytes
2599 bytes
As the following source file demonstrates, G++ 1.35.0 (pre-release Sun3)
allows you to declare formal arguments to be of type "void&".
According to "The Book" (page 270) this should not be legal.
b038 had missed error(s) as follows:
8: void test2 (void& formal_void_ref) // ERROR
b038: FAILED
----------------------------------------------------------------------------
// Check that it is illegal to declare a reference-to-void
// type object.
const void* null = 0;
void& global_void_ref = *null; // ERROR
void test2 (void& formal_void_ref) // ERROR
{
void& local_void_ref = formal_void_ref; // ERROR
}
void test ()
{
void& local_void_ref = *null; // ERROR
test2 (local_void_ref);
}
-----------------------------------------------------------------------------
/usr/local/src/src/g++/build/sun3/1.35-.0-.0/g++ -B/usr/local/src/src/g++/build/sun3/1.35-.0-.0/ -ansi -pedantic -Wall -Wwrite-strings -S -v b038.C
g++ version 1.35.0-
/usr/local/src/src/g++/build/sun3/1.35-.0-.0/cpp -+ -v -undef -D__GNU__ -D__GNUG__ -T -D__STRICT_ANSI__ -D__mc68000__ -D__sun__ -D__unix__ -pedantic -Wall -D__HAVE_68881__ b038.C /tmp/cca17992.cpp
GNU CPP version 1.35.0-
/usr/local/src/src/g++/build/sun3/1.35-.0-.0/c++ /tmp/cca17992.cpp -quiet -dumpbase b038.C -Wall -Wwrite-strings -pedantic -ansi -noreg -version -o b038.s
GNU C++ version 1.35.0- (68k, MIT syntax) compiled by GNU C version 1.34.1.
b038.C:6: invalid type: `void &'
b038.C:6: variable or field `global_void_ref' declared void
b038.C:6: invalid use of void expression
b038.C:9: invalid type: `void &'
In function void test2 ():
b038.C:10: invalid type: `void &'
b038.C:10: variable or field `local_void_ref' declared void
b038.C:10: `formal_void_ref' was not declared (first use this function)
b038.C:10: (Each undeclared identifier is reported only once
b038.C:10: for each function it appears in.)
b038.C:10: warning: unused variable `local_void_ref'
In function void test ():
b038.C:15: invalid type: `void &'
b038.C:15: variable or field `local_void_ref' declared void
b038.C:15: invalid use of void expression
b038.C:9: too many arguments to function `void test2 ()'
b038.C:17: at this point in file
Technical Details
Message-ID:
<8904221816.AA18018@riunite.aca.mcc.com>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MCC.COM!rfgShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!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 (pre-release) void& formals allowed Message-ID: <8904221816.AA18018@riunite.aca.mcc.com> Date: 22 Apr 89 18:16:37 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 51