[Issue 15192] New: DIP25: Nested ref returns are type checked unsoundly
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 12 03:43:19 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15192
Issue ID: 15192
Summary: DIP25: Nested ref returns are type checked unsoundly
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: timon.gehr at gmx.ch
The following code corrupts memory:
enum N=100;
ref int[N] fun(ref int[N] x)@safe{
ref int[N] bar(){ return x; }
return bar();
}
ref int[N] hun()@safe{
int[N] k;
return fun(k);
}
void bang(ref int[N] x)@safe{ x[]=0x25BAD; }
void main()@safe{ bang(hun); }
--
More information about the Digitalmars-d-bugs
mailing list