[Issue 21517] New: Functions nested within `inout` functions can reinterpret `inout`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 30 22:29:21 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21517
Issue ID: 21517
Summary: Functions nested within `inout` functions can
reinterpret `inout`
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: timon.gehr at gmx.ch
int* g(immutable(int)* y)pure @safe{
int* foo(inout(int)* x)pure @safe{
int* bar(inout(int)* delegate(inout int)pure @safe z){
return z(2);
}
return bar((inout t)=>x);
}
return foo(y);
}
void main()pure @safe{
auto x=new immutable int;
int* y=g(x);
assert(x is y); // passes, bad
}
--
More information about the Digitalmars-d-bugs
mailing list