Article View: gnu.g++.bug
Article #560scope of enumerators
From: Jochen Schwarze
Date: Wed, 08 Nov 1989 21:06
Date: Wed, 08 Nov 1989 21:06
30 lines
1285 bytes
1285 bytes
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
Technical Details
Message-ID:
<2113@isaak.isa.de>Path:
arc1-ca.pugleaf.net!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!schwarzeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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