public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* static const enums and "storage class specified for typename" errors
@ 2001-01-04  7:47 George R. Lee Jr.
  0 siblings, 0 replies; 2+ messages in thread
From: George R. Lee Jr. @ 2001-01-04  7:47 UTC (permalink / raw)
  To: gcc-help

I have the following code:

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

which gets a "storage class specified for typeanme" error.

Am I allowed to declare enums const and static under gcc?
(This, incidentally, conpiled under Microsoft's Visual C++ compile
without any errors.)

George Lee
george@links2go.com
Links2Go, Inc.

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

* RE: static const enums and "storage class specified for typename" errors
@ 2001-01-04  7:54 David Korn
  0 siblings, 0 replies; 2+ messages in thread
From: David Korn @ 2001-01-04  7:54 UTC (permalink / raw)
  To: 'George R. Lee Jr.', gcc-help

>-----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
**********************************************************************

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

end of thread, other threads:[~2001-01-04  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-04  7:47 static const enums and "storage class specified for typename" errors George R. Lee Jr.
2001-01-04  7:54 David Korn

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).