Bug? enum inside class limited to integral values
Jeremie Pelletier
jeremiep at gmail.com
Mon Apr 27 02:27:13 PDT 2009
I don't know if its a bug or intended behavior, the documentation doesn't mention this.
Enums in the global scope can allow any type for declarations:
---
enum {
FOO = 1, BAR = "foobar"
}
---
However, when using the same syntax within a class, the compiler spits out a nasty Error: Integer constant expression expected instead of "foobar". When using the enum as a manifest constant, (enum BAR = "foobar";) it works just fine.
If this behavior is intentional, may I ask why? I fail to assume a rationale behind having different behaviors from global scope to class scope for this.
More information about the Digitalmars-d
mailing list