This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: static const enums and "storage class specified for typename" errors


>-----Original Message-----
>From: George R. Lee Jr. [mailto:george@topicalstorm.com]
>Sent: 04 January 2001 15:53

>I have the following code:
>
>class A {
>    ...
>    protected:
>        static const enum foo {...};
>}
>
>which gets a "storage class specified for typeanme" error.

  Try this:

enum footype { ... };

class A {
     ...
     protected:
        static const footype foo;
}

  The problem here is a confusion between declaring the list of values
allowable for the enum, and declaring a variable containing one of the
enum values. 

>Am I allowed to declare enums const and static under gcc?

  It shouldn't be a problem; but it's meaningless to try and declare
the type static const, rather than declaring a variable OF that type
static and const.

>(This, incidentally, conpiled under Microsoft's Visual C++ compile
>without any errors.)

  I don't know C++ well enough to tell you who's right and who's wrong in
this case, although it may be the case that anonymous enums aren't allowed
in C++.

      DaveK
-- 
The Boulder Pledge: "Under no circumstances will I ever purchase anything 
offered to me as the result of an unsolicited email message. Nor will I 
forward chain letters, petitions, mass mailings, or virus warnings to large 
numbers of others. This is my contribution to the survival of the online
community." 


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]