[Issue 12936] Some more @nogc cases for immediately iterated array literal
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Mar 11 02:53:40 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=12936
--- Comment #1 from bearophile_hugs at eml.cc ---
A different case where the compiler should avoid heap allocations and allow
@nogc:
void main() @nogc {
int[3] a;
a[] = [1, 2, 3];
a[0 .. 2] = [1, 2];
}
temp.d(3,11): Error: array literal in @nogc function main may cause GC
allocation
temp.d(4,17): Error: array literal in @nogc function main may cause GC
allocation
--
More information about the Digitalmars-d-bugs
mailing list