public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* enum underlying type specifier
@ 2007-05-18 19:20 Kevin Yohe
  2007-05-18 23:21 ` John (Eljay) Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Yohe @ 2007-05-18 19:20 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: enum underlying type specifier
  2007-05-18 19:20 enum underlying type specifier Kevin Yohe
@ 2007-05-18 23:21 ` John (Eljay) Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: John (Eljay) Love-Jensen @ 2007-05-18 23:21 UTC (permalink / raw)
  To: Kevin Yohe, gcc-help

Hi Kevin,

Unless I'm mistaken, that's not compliant C++ for an enum.  Maybe it's a C99-ism?  (I'm not C99 savvy.)

Personally, I wish enum's did have that kind of size specifying syntax, like that did on my old Amiga C compiler as a C language extension... hmmm, was that Lattice C or Manx C... I don't recall now.

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-18 23:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-18 19:20 enum underlying type specifier Kevin Yohe
2007-05-18 23:21 ` John (Eljay) Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).