🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #78

BUG in G++ 1.35.0/sun3 (b079)

#78
From: Ron Guilmette
Date: Sun, 25 Jun 1989 21:37
45 lines
1913 bytes
The following code fails to elicit an error message on line 9
from G++ 1.35.0/sun3.

----------------------------------------------------------------------
// Check that if a constant object is declared as external, it may not
// also be initialized to a value in the same declarative statement.
//
// Cases:
//	file scope
//	function local scope
//	block scope

extern const int global_int_const = 11;			// ERROR

int j;
void fake (int i) { j = i; }

int main ()
{
	extern const int local_int_const = 33;		// ERROR

	fake (local_int_const);
	if (j)
	{
		extern const int block_local = 55;	// ERROR

		fake (block_local);
	}
	fake (global_int_const);
	return 0;
}
-------------------------------------------------------------------------
g++-1.35.0.0 -g -Wall -Wwrite-strings -v -S b079.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 b079.C /tmp/cca20766.cpp
GNU CPP version 1.35
 /usr/local/src/lib/sun3/g++-1.35.0.0/gcc-cc1plus /tmp/cca20766.cpp -quiet -dumpbase b079.C -Wall -Wwrite-strings -noreg -version -G -o b079.s
GNU C++ version 1.35.0 (68k, MIT syntax) compiled by GNU C version 1.35.
In function int main ():
b079.C:16: `local_int_const' has both `extern' and initializer
b079.C:21: `block_local' has both `extern' and initializer


b079 had missed error(s) as follows:
	   9: extern const int global_int_const = 11;			// ERROR
Technical Details
Message-ID: <8906252137.AA20793@pink.aca.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!MCC.COM!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!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/sun3 (b079)
Message-ID: <8906252137.AA20793@pink.aca.mcc.com>
Date: 25 Jun 89 21:37:09 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 45