Bug 19559 – Unsound escape analysis of struct members

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-01-08T21:41:52Z
Last change time
2019-01-08T22:10:18Z
Assigned to
No Owner
Creator
Yuxuan Shui

Comments

Comment #0 by yshuiv7 — 2019-01-08T21:41:52Z
This code shouldn't compile. @safe void bad(int *p) { struct A { int z; @safe void badbad(int *p) { p = &z; } } A badstuff; badstuff.badbad(p); } @safe void main() { int *p = null; bad(p); *p = 10; // <- boom } https://d.godbolt.org/z/xXxecF