www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13381] New: One case of array literal that can be


          Issue ID: 13381
           Summary: One case of array literal that can be stack-allocated
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

I think this is an array literal usage pattern where the compiler can allocate
the array on the stack, allowing the function foo to be  nogc:

void foo(in uint[] a)  nogc {
    if (a == [1]) {}
void main() {}

Currently dmd 2.067alpha gives:

temp.d(2,14): Error: array literal in  nogc function foo may cause GC

Aug 27 2014