digitalmars.D.bugs - [Issue 19380] New: Access through nested struct's .init does not
- d-bugmail puremagic.com (37/37) Nov 08 2018 https://issues.dlang.org/show_bug.cgi?id=19380
https://issues.dlang.org/show_bug.cgi?id=19380 Issue ID: 19380 Summary: Access through nested struct's .init does not segfault Product: D Version: D2 Hardware: All OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: stanislav.blinov gmail.com Perhaps not the title you'd expect on an issue tracker, but hopefully the code makes it clear: ``` void main() { int x; struct S { void foo() { x++; // nested, accessing main's frame } } assert(S.init.tupleof[$-1] is null); // if the above assertion passes, how come this doesn't segfault?.. S.init.foo(); // A import std.stdio; writeln("You shouldn't be here... ", x); // compared to: S s = S.init; assert(s.tupleof[$-1] is null); s.foo(); // B } ``` It does (correctly?) segfault on A when compiled with LDC, but only on B with DMD. --
Nov 08 2018