Surprisingly you can put other decl-specifiers in there too.
This compiles fine in VS2008:
auto const enum TestEnum {
Why,
Does
};
register volatile enum TestEnum2 {
This,
Work
};
But it makes no sense at all :)
I suspect the problem here is in the parsing, because code like this:
enum TestEnum3 { Hello, World }; // Define enum
enum TestEnum3 x = World; // Use enum
Could also be written as:
enum TestEnum3 { Hello, World } x = World; // Define and use enum.
Interestingly, I notice if you do this in VS2008:
enum TestEnum3 { Hello, World };
const enum TestEnum3 e3 = World;
const enum TestEnum4 { F, M, L } e4 = F;
e3 = Hello; // error C2166: l-value specifies const object (Good!)
e4 = M; // NO ERROR here though - why?
So they are not equivalent as in the TestEnum4
case it seems to be throwing away the const
decl-specifier. All very odd.