🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

g++ 2.2.2 bug wrt typedefs renaming class-local enumeration typedefs

#17
From: Robert R. Henry
Date: Fri, 30 Oct 1992 22:00
35 lines
1422 bytes
The program contained at the bottom of this document
causes g++ from gcc2.2.2 to emit the error message embedded
in the program.

If I #define NOBUG, then the error goes away;
evidently the routine definitions do something to the definition of COLOR
that causes the structure field declaration to then be happy.
Another ARM compliant C++ implementation swallows this without complaint.

I hope that this is fixed in gcc2.3, since this is a show stopper for us.


class Foo {
    public:
      enum Color { red, green, blue } ;
   
      Color next_color(Color) ;
      Color this_color(Color) ;
} ;

typedef Foo::Color COLOR;

#ifdef NOBUG
COLOR Foo::next_color(COLOR c) {
      return (enum Color)(c == blue ? red : c +1);
}
Foo::Color Foo::this_color(COLOR c) {
      return (enum Color)(c == blue ? red : c +1);
}
#endif

struct Baz {
      static COLOR color ;
/*###22 [cc] class-local enum declaration `Color' is not in scope here%%%*/
} ;
Technical Details
Message-ID: <9210302200.AA22886@tera.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tera.com!rrh

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tera.com!rrh
From: rrh@tera.com (Robert R. Henry)
Subject: g++ 2.2.2 bug wrt typedefs renaming class-local enumeration typedefs
Message-ID: <9210302200.AA22886@tera.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 30 Oct 1992 22:00:48 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 36