Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 23, 2011 What's wrong with this enum? | ||||
---|---|---|---|---|
| ||||
// 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. |
February 24, 2011 Re: What's wrong with this enum? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | 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.
|
February 24, 2011 Re: What's wrong with this enum? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 2/24/11, Jesse Phillips <jessekphillips+D@gmail.com> wrote: > I believe it is because > > shapes.Circle["CoolCircle"] = 25; Huh? > perhaps a a defining: > > enmu shapes : const(int[string]) > > would work? Nope. enumtwobug.d(10): Error: non-constant expression ["CoolCircle":cast(const(int))50] > > Anyway with DMD 2.052 I'm not getting your error. > What OS are you running? I'm running 2.052 and getting the error on Windows. Maybe it's an OS-specific bug. |
February 24, 2011 Re: What's wrong with this enum? | ||||
---|---|---|---|---|
| ||||
I've tested on Ubuntu it still errors out. |
Copyright © 1999-2021 by the D Language Foundation