[Issue 22506] New: Accessing immutable AA in @nogc with index results in compilation error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 12 10:48:06 UTC 2021
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 at puremagic.com
Reporter: muhammed.yucel at 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];
}
--
More information about the Digitalmars-d-bugs
mailing list