Error with associative array initializer DMD32 D Compiler v2.070.0

Andrew Edwards via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 3 05:17:20 PST 2016


On 3/3/16 7:01 PM, MGW wrote:
> immutable long[string] aa = [
>     "foo": 5,
>     "bar": 10,
>     "baz": 2000
> ];

The only way this can be done outside the body of a function is if it is 
a manifest constant. This works:

enum long[string] aa = [
     "foo": 5,
     "bar": 10,
     "baz": 2000
];


More information about the Digitalmars-d-learn mailing list