non-constant expression ["foo":5, "bar":10, "baz":2000]

Paolo Invernizzi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 26 09:37:57 PST 2016


This is stated in documentation [1]:

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

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

But results to:

    Error: non-constant expression ["foo":5L, "bar":10L, 
"baz":2000L]

Known bug?
If yes, Is there the need to emend the documentation, till the 
bug is open?
---
/Paolo


More information about the Digitalmars-d-learn mailing list