www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17430] New: [scope] delegate can escape context ptr

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

          Issue ID: 17430
           Summary: [scope] delegate can escape context ptr
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
struct S { void foo() {} }

void delegate() bar()  safe
{
    S s;
    auto dg = &s.foo; // should be inferred as scope
    return dg;
}
CODE

dmd -c -dip1000 bug

--
May 24