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