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

          Issue ID: 17959
           Summary: [DIP1000] Can store scope delegate in non-scope member
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

The following segfault:

```
class Foo
{
    private void delegate () @safe escape;
    void esc () @safe scope
    {
        this.escape = &this.esc;
    }
}

void main () @safe
{
    auto x2 = bar();
    assert(x2 !is null);
    x2();
}

void delegate() @safe bar () @safe
{
    scope o = new Foo;
    o.esc;
    return o.escape;
}
```

I'd except the assignment in esc to fail.
Tested with v2.076.1 and f3446967d

--

Reply via email to