You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DMD v2.075.0:
@safe:
int a;
immutable(int) b=2;
inout(int)* delegate(inout(int)*)@safe delegate()@safe foo(inout(int)* y){
inout(int)* bar(inout(int)* p){
return y;
}
return ()=>&bar;
}
void main(){
int* y=foo(&b)()(&a);
*y=3;
assert(&b is y); // passes. ouch.
assert(b is *&b); // fails!
}
If &bar is returned directly instead of ()=>&bar, DMD applies a strange work-around (it replaces `inout` in the returned delegate by `const`).
The text was updated successfully, but these errors were encountered:
timon.gehr reported this on 2017-08-11T15:41:13Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=17744
CC List
Description
The text was updated successfully, but these errors were encountered: