What's wrong with this enum?

Jesse Phillips jessekphillips+D at gmail.com
Wed Feb 23 16:02:39 PST 2011


Andrej Mitrovic Wrote:

> // Works
> enum : int[string]
> {
>     Circle = ["CoolCircle":50]
> }    
> 
> //  Error: non-constant expression ["CoolCircle":50]
> enum shapes : int[string]
> {
>     Circle = ["CoolCircle":50]
> }
> 
> I can't find this in bugzilla.

I believe it is because

shapes.Circle["CoolCircle"] = 25;

perhaps a a defining:

enmu shapes : const(int[string])

would work?

Anyway with DMD 2.052 I'm not getting your error.


More information about the Digitalmars-d-learn mailing list