🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

BUG(s) in G++ 1.34.1 and 1.35.0 (pre-release)

#1893
From: Ron Guilmette
Date: Fri, 21 Apr 1989 18:59
79 lines
2394 bytes
When the following code is compiled with g++ 1.34.1 (Sun3) it misses the
error on line 39 where the function member called "base_member_7" is
redeclared (within the same class) to be a data member.

When this code is compiled with G++ 1.35.0 (pre-release from yahi, April 20th)
the compiler SegFaults.  I would say off-hand that this is worse than the
response given by 1.34.1 :-) Progress? :-)

--------------------------------------------------------------------------
// Check that that it is an error to declare a variable within a given
// scope and then to redeclare that variable within the same scope.
// Check that this is true whether or not the latter declaration has
// the same type.
//
// Also check that it is an error to try to overload a class data member
// as a class function member (or vise versa) within a given class.
//
// Cases:
//	global
//	within a function
//	within a method
//	within a struct
//	within a class
//	across visibility sections of a single class

int global_var;
int global_var;				// ERROR
float global_var;			// ERROR

struct structure {
	int field;
	int field;			// ERROR
	float field;			// ERROR
};

class base {
	int base_member_1;
	int base_member_1;		// ERROR
	float base_member_1;		// ERROR
	int base_member_2;
	int base_member_3;
	int base_member_4;
	int base_member_5 ();
	int base_member_6;
	int base_member_7 ();
public:
	int base_member_6;		// ERROR
	int base_member_7;		// ERROR - data member can't be overloaded
	base ();
};

class derived : private base {
	int base_member_2;		// OK - can overload inherited data members
	double base_member_3;		// OK - can even be a different type
	int base_member_4 ();		// OK
	int base_member_5;		// OK
public:
	derived ();
};

int test ()
{
	int local_var;
	int local_var;			// ERROR
	float local_var;		// ERROR

	local_var = 1;
	return 0;
}

base::base ()
{
	int local_var;
	int local_var;			// ERROR
	float local_var;		// ERROR

	local_var = 1;
}
Technical Details
Message-ID: <8904211859.AA13401@riunite.aca.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MCC.COM!rfg

Show 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(s) in G++ 1.34.1 and 1.35.0 (pre-release)
Message-ID: <8904211859.AA13401@riunite.aca.mcc.com>
Date: 21 Apr 89 18:59:30 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 79