enum underlying type specifier

Kevin Yohe kevin@ssc-nh.com
Fri May 18 19:20:00 GMT 2007


Hi,

I am trying to compile the following code using gcc-4.1.0,

typedef unsigned short tWord16;

         ...

typedef
   enum eFoo : tWord16
      {  // eFoo
         Foo1 = 1,
         Foo2 = 2,
         ...
      }  // eFoo
   tFoo;

         ...

and get the following errors,

powerpc-750-elf-gcc -c -r -gdwarf-2 -fno-exceptions -fno-weak -fno-check-new
Foo.cpp -o Foo.o
Foo.h:30: error: use of enum 'eFoo' without previous declaration
Foo.h:30: error: expected unqualified-id before ':' token

Is the following grammar,

enum [identifier [: type]] { ... }

not standard c++?

If so, can I control the c++ dialect using a compiler flag to allow this to
compile.

Regards,
Kevin




More information about the Gcc-help mailing list