TIL: statically initializing an Associative Array
Andy Valencia
dont at spam.me
Tue May 7 04:26:18 UTC 2024
On Tuesday, 7 May 2024 at 01:14:24 UTC, Steven Schveighoffer
wrote:
> On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote:
>> I had a set of default error messages to go with error code
>> numbers, and did something along the lines of:
>>
>> string[uint] error_text = [
>> 400: "A message",
>> 401: "A different message"
>> ];
>>
>> and got "expression .... is not a constant"
> ...
> This was fixed [in
> 2.106.0](https://dlang.org/changelog/2.106.0.html#dmd.static-assoc-array)
>
> please upgrade your compiler.
I'm using ldc2 from Debian stable; great news that it's fixed as
of late 2023. I'll probably live with my workaround, but it's
good to know that it's a bug which has been resolved.
Thank you!
Andy
More information about the Digitalmars-d-learn
mailing list