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: [email protected]
Reporter: [email protected]
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!
}
--