[gnu.g++.bug] g++ 01079001 bug - nested structs/unions/classes don't have nested scope

rfg@ICS.UCI.EDU (01/08/90)

// 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
}