www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17743] New: Type system hole: escaping inout delegates

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 puremagic.com
          Reporter: timon.gehr 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!
}

--
Aug 11