[Issue 17804] New: Accessing `enum' or `static' member allocates gc closure

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 4 10:01:46 UTC 2017


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

          Issue ID: 17804
           Summary: Accessing `enum' or `static' member allocates gc
                    closure
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: timon.gehr at gmx.ch

struct S{
    enum n=1;
}
struct T{
    static n=1;
}

void foo(S v)@nogc{
    auto f=()=>v.n; // error
}
void bar(T v)@nogc{
    auto f=()=>v.n; // error
}

This code should compile.

Also see issue 17800.

--


More information about the Digitalmars-d-bugs mailing list