Xref: utzoo gnu.g++.bug:1083 comp.lang.c++:5472 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!bloom-beacon!eru!luth!sunic!mcsun!unido!isaak!isaak.isa.de!schwarze From: schwarze@isaak.isa.de (Jochen Schwarze) Newsgroups: gnu.g++.bug,comp.lang.c++ Subject: scope of enumerators Message-ID: <2113@isaak.isa.de> Date: 8 Nov 89 21:06:13 GMT Sender: news@isaak.isa.de Reply-To: schwarze@isaak.isa.de (Jochen Schwarze) Distribution: gnu, world Organization: ISA GmbH, Stuttgart, West-Germany Lines: 30 Consider the following: struct color { enum { red, green, blue } type; }; main() { struct color favourite; favourite.type = red; } If this piece of code is compiled with g++ (1.35.0) or AT&T cfront (1.20) both compilers complain about `red' in line 10 being undefined or undeclared, resp. gcc (1.35.0) and Sun cc compile without problems. The C++ book by Stroustrup says nothing about an enumerators scope being restricted. Is this a compiler bug or a difference between c and c++? Thanks in advance. Jochen Schwarze Domain: schwarze@isaak.isa.de ISA GmbH, Stuttgart, West Germany UUCP: schwarze@isaak.uucp Bang: ...!uunet!unido!isaak!schwarze