[Issue 17743] New: Type system hole: escaping inout delegates

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 11 08:36:42 PDT 2017


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

          Issue ID: 17743
           Summary: Type system hole: escaping inout delegates
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: timon.gehr at gmx.ch

DMD v.2075.0:

@safe:
int a;
immutable(int) b=2;

inout(int)* delegate(inout(int)*) dg;
inout(int)* prepare(inout(int)* x){
    dg = y=>x;
    return x;
}
void main(){
    prepare(&b);
    int* y=dg(&a);
    assert(&b is y); // passes. ouch.
    *y=3;
    assert(b is *&b); // fails!
}

--


More information about the Digitalmars-d-bugs mailing list