digitalmars.D.bugs - [Issue 22506] New: Accessing immutable AA in nogc with index
- d-bugmail puremagic.com (30/30) Nov 12 2021 https://issues.dlang.org/show_bug.cgi?id=22506
https://issues.dlang.org/show_bug.cgi?id=22506 Issue ID: 22506 Summary: Accessing immutable AA in nogc with index results in compilation error Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: muhammed.yucel bosagora.io It will throw the following compilation error Error: indexing an associative array in ` nogc` function `app.myfunc` may cause a GC allocation Here is a code example: immutable int[int] aa; shared static this () { aa[10] = 20; aa[20] = 30; } int myfunc () nogc { return aa[10]; } --
Nov 12 2021