www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17804] New: Accessing `enum' or `static' member allocates gc

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

--
Sep 04