bug in doc?

spir denis.spir at gmail.com
Thu Mar 14 14:22:52 UTC 2019


https://dlang.org/spec/hash-map.html#static_initialization:

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

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

Also: I don't understand the error message:
* What is non-constant in the *expression*?
* And why should it be constant at all?
(Removing "immutable" does not help...)

diniz


More information about the Digitalmars-d-learn mailing list