digitalmars.D.bugs - [Issue 20803] New: Objects are destroyed too early with -inline
- d-bugmail puremagic.com (36/36) May 07 2020 https://issues.dlang.org/show_bug.cgi?id=20803
https://issues.dlang.org/show_bug.cgi?id=20803 Issue ID: 20803 Summary: Objects are destroyed too early with -inline Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: wrong-code Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net //////////////// test.d //////////////// struct V { bool alive = true; void checkAlive() { assert(alive); } } struct S { V v; disable this(this); ~this() { v.alive = false; } } void main() { S().v.checkAlive(); } //////////////////////////////////////// Works fine without -inline, assert trips with -inline. This affects std.typecons.RefCounted. Because this bug causes it to return a dangling pointer into manually-allocated memory, it can cause memory corruption. --
May 07 2020