digitalmars.D - Bug? enum inside class limited to integral values
- Jeremie Pelletier (9/9) Apr 27 2009 I don't know if its a bug or intended behavior, the documentation doesn'...
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.
Apr 27 2009








Jeremie Pelletier <jeremiep gmail.com>