https://issues.dlang.org/show_bug.cgi?id=20812
Steven Schveighoffer <schvei...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |safe, wrong-code CC| |schvei...@gmail.com --- Comment #3 from Steven Schveighoffer <schvei...@gmail.com> --- I further diagnosed this. You don't need to declare the shared aa separately, this will do: ```d void main() { shared aa = ["abc": "123"]; } ``` If you declare `aa` as const instead, the `ti` parameter passed to `_d_assocarrayliteralTX` is a legit `TypeInfo_AssociativeArray`. However, when you use shared, the `ti` parameter is pointing to the wrapping `TypeInfo_Shared`. Note that this is a *reinterpret cast*, not a dynamic cast, and so it really thinks it's pointing at a `TypeInfo_AssociativeArray`. Therefore the `key` field doesn't actually exists, and is garbage. I'm not sure on LDC if this is a similar problem but it's possible since it's reading invalid memory it happens to work? I tend to think not. I ran on run.dlang.io for all compilers, and all segfault. So this has been happening for a while. const, immutable, and inout all do not have this problem, only shared. I also confirmed this is a problem on gdc. --