[Issue 17800] New: [2.076] "static foreach" allocates closures in GC without reason

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 2 06:49:27 UTC 2017


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

          Issue ID: 17800
           Summary: [2.076] "static foreach" allocates closures in GC
                    without reason
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ilyayaroshenko at gmail.com

struct S
{
    enum N = 1;
}

void foo(S v) @nogc
{
    static foreach(_; 0 .. v.N)
    {
    }
}

----
Error: function mir.ndslice.slice.foo is @nogc yet allocates closures with the
GC
source\mir\ndslice\slice.d(290,23):        
foo.__lambda2.__lambda1 closes over variable v

--


More information about the Digitalmars-d-bugs mailing list