www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15232] New: Escape analysis should be more sophisticated

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

          Issue ID: 15232
           Summary: Escape analysis should be more sophisticated
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

Consider the following code:

void foo() nogc{
    int x;
    struct S{ int bar() nogc{ return x; } }
    S s;
}

Error: function foo  nogc function allocates a closure with the GC

No closure should be allocated here and in similar cases.

--
Oct 21 2015