The following code:

#define CHAR_BIT 8
enum EE {ee};
typedef unsigned int T;

struct D {
        T : sizeof(unsigned int) * CHAR_BIT; // OK
        EE : sizeof(EE) * CHAR_BIT; // OK 
        enum EE : sizeof(EE) * CHAR_BIT; // not OK 
        enum EE xxxx : sizeof(EE) * CHAR_BIT; // OK 
        T x : sizeof(unsigned int) * CHAR_BIT; // OK
        enum FF {ff} : sizeof(int) * CHAR_BIT; // OK 
} element;

enum EE xx;
EE yy;

has an issue (parser error) with the following version of g++:
g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-threads=posix
--prefix=/prj/dsp/qdsp6_aus/users/slarin/x86_gcc_4.4/bin
--enable-languages=c,c++ --disable-checking
Thread model: posix
gcc version 4.4.0 (GCC)

The issue is the third member of the struct (enum EE : sizeof(EE) * CHAR_BIT;)
In my understanding it is no different than the second member of the same
struct (EE : sizeof(EE) * CHAR_BIT;) and clearly works outside the struct scope
(enum EE xx; EE yy;)..and further "cured" by giving it a name (enum EE xxxx :
sizeof(EE) * CHAR_BIT;) - this would be a workaround. My question - is this a
front end regression between 4.3.2 and 4.4.0? 

As for the regression statement - it works with G++ 3.3.3, 3.4.6 and 4.3.2. The
C++98 standard clauses that seems appropriate are 9.6, 9.7 and 7.2. If this is
a deliberate decision to change the acceptable syntax, what clauses from the
same standard can you refer to? 

Thank you.


-- 
           Summary: unnamed bitfield declaration parser regression
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sergei_lus at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41127

Reply via email to