www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13576] New: One more array nogc literal case

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 puremagic.com
          Reporter: bearophile_hugs 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

--
Oct 06 2014