digitalmars.D.bugs - [Issue 13902] New: Compiler allows escaping the address of part of a
- via Digitalmars-d-bugs (30/30) Dec 27 2014 https://issues.dlang.org/show_bug.cgi?id=13902
https://issues.dlang.org/show_bug.cgi?id=13902 Issue ID: 13902 Summary: Compiler allows escaping the address of part of a local Product: D Version: D2 Hardware: x86 OS: All Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: andrei erdani.com Currently the compiler disallows this: ref int fun() { int x; return x; // escape the address of a local } However, this goes unchecked: struct S { int x; } ref int fun() { S s; return s.x; // escape the address of part of a local } Direct member access is easy to check using the same logic, so I'm filing this as a bug. DIP25 addresses more sophisticated detection cases. --
Dec 27 2014