www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17568] New: [scope] addresses to fields can be escaped from

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

          Issue ID: 17568
           Summary: [scope] addresses to fields can be escaped from scope
                    method
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
int* p;
struct T
{
    int a;
    void escape()  safe scope
    {
        p = &a;
    }
}

void escape()  safe
{
    {
        T t;
        t.escape;
    }
    auto bug = *p;
}
CODE
dmd -c -dip1000 bug
----
Tested with v2.075.0-b1

--
Jun 28