Article View: gnu.g++.bug
Article #1126Bug parsing enumerators in nested enum with gcc 2.3.1
From: lewis
Date: Mon, 09 Nov 1992 18:15
Date: Mon, 09 Nov 1992 18:15
35 lines
1501 bytes
1501 bytes
/*
* I believe the initializer below should be allowed?
* I've found nothing in the ARM that proves this conclusively,
* but ARM page 114 gives an example of an enum with the initializer
* for the enumerator being an expression involving a previously
* defined initializer. The example was a global enum, not a nested
* one however.
*
* The problem seems to be that you consider the scope of the initializers
* to be the global scope, and I think the scope should include the current
* enumerators.
*
*
* The file is compiled with gcc 2.3.1 as follows:
* g++ -c bug.c
*
* and the output is:
*
* bug.c:32: `b' undeclared, outside of functions
* bug.c:32: enumerator value for `bfirst' not integer constant
*/
enum {
a,
first = a, // compiles OK
};
struct fred {
enum {
b,
bfirst = b, // compiles with CFront, but not g++
};
};
Lewis Gordon Pringle, Jr. (lewis@sophists.com)
Technical Details
Message-ID:
<m0mon0L-000AWzC@sophists.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ames!sun-barr!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sophists.COM!lewisShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ames!sun-barr!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sophists.COM!lewis From: lewis@sophists.COM Subject: Bug parsing enumerators in nested enum with gcc 2.3.1 Message-ID: <m0mon0L-000AWzC@sophists.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 9 Nov 1992 18:15:05 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 37