🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Ron Guilmette Sun, 25 Jun 1989 21:37
BUG in G++ 1.35.0/sun3 (b079)
#78
Author: 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
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