[Issue 12932] Support @nogc for immediately iterated array literal

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 16 09:10:34 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12932

--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to bearophile_hugs from comment #4)
> Currently this gets rejected, is this right?
> 
> void main() @nogc {
>     foreach (       a; [[1]]) {}
>     foreach (int[1] a; [[1]]) {}
> }
> 
> 
> test.d(2): Error: array literal in @nogc function main may cause GC
> allocation
> test.d(3): Error: array literal in @nogc function main may cause GC
> allocation

My PR does not support complex case. It would need more thought to improve the
feature.

--


More information about the Digitalmars-d-bugs mailing list