Error with associative array initializer DMD32 D Compiler v2.070.0

MGW via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 3 02:35:50 PST 2016


The citation from https://dlang.org/spec/hash-map.html

Static Initialization of AAs
----------------------------

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

unittest
{
     assert(aa["foo"] == 5);
     assert(aa["bar"] == 10);
     assert(aa["baz"] == 2000);
}

Judging by the text, it is static initialization, during 
compilation.



More information about the Digitalmars-d-learn mailing list