Comment #0 by stanislav.blinov — 2018-11-09T04:12:34Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:01:17Z