🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

g++ 01079001 bug - nested structs/unions/classes don't have nested scope

#2137
From: rfg
Date: Sun, 07 Jan 1990 16:53
26 lines
1116 bytes
// Unlike GCC and Cfront 2.0, the g++ 1.36.1 compiler seems to be treating
// the scope of struct, union, and class declarations which are nested within
// blocks as being global.

#ifdef __GNUC__
#define class struct
#endif

class c1 { int c1_member1; };
struct s1 { int s1_member1; };
union u1 { int u1_member1; };
enum e1 { e1_val1 };
typedef int t1;

void foo ()
{
  class c1 { int c1_member1; };	 // error: redeclaration of c1
  struct s1 { int s1_member1; }; // error: redeclaration of s1
  union u1 { int u1_member1; };  // error: redeclaration of u1

  enum e1 { e1_val1 };		// OK using g++ or GCC, but mishandled by
				//   Cfront 2.0.

  typedef int t1;		// OK
}
Technical Details
Message-ID: <9001070853.aa03577@ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg
From: rfg@ICS.UCI.EDU
Newsgroups: gnu.g++.bug
Subject: g++ 01079001 bug - nested structs/unions/classes don't have nested scope
Message-ID: <9001070853.aa03577@ICS.UCI.EDU>
Date: 7 Jan 90 16:53:27 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 26