https://issues.dlang.org/show_bug.cgi?id=23531
Issue ID: 23531 Summary: [DIP1000] scope variable can be assigned as AA key Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: pro.mathias.l...@gmail.com ``` void main () @safe { auto r = bar(); assert(r["foo!"] == "oi"); } string[string] bar () @safe { immutable(char)[4] s = "foo!"; return foo(s); } string[string] foo (scope string f) @safe { string[string] aa; aa[f] = "oi"; return aa; } ``` Results in RangeError because the key is garbage. Funny thing is that assigning `f` as the value of the AA (e.g. `aa[f] = f;`) is correctly detected. --