www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17959] New: [DIP1000] Can store scope delegate in non-scope


          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: nobody puremagic.com
          Reporter: mathias.lang sociomantic.com

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);

void delegate()  safe bar ()  safe
    scope o = new Foo;
    return o.escape;

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

Nov 01 2017