[Issue 2954] [tdpl] Allow to set associative array key value only using expression AA key type is constructable from

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 27 16:43:41 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=2954

--- Comment #16 from hsteoh at qfbox.info ---
Niche or not, this problem ought to be fixed. It's been how long now, and we
still haven't gotten our act together on AA's.

Lookups should be permissive and allow types that are comparable with the key
type (e.g., using a char[] to lookup a T[string] should be fine).

Assignment, however, must be much stricter because of aliasing issues; it
should only allow types implicitly convertible to the key type (it's illegal to
assign a char[] key to T[string], because if the key is subsequently modified
via the mutable reference, the AA breaks.)

--


More information about the Digitalmars-d-bugs mailing list