[Issue 13576] New: One more array @nogc literal case

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Oct 6 06:17:39 PDT 2014


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

          Issue ID: 13576
           Summary: One more array @nogc literal case
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc

I am not sure but perhaps this can be accepted:


immutable int[] a;
static this() @nogc {
    a = [1];
}
void main() {}


dmd 2.067alpha gives:

temp.d(3,9): Error: array literal in @nogc function _staticCtor1 may cause GC
allocation

--


More information about the Digitalmars-d-bugs mailing list