Comment #0 by iamthewilsonator — 2022-01-07T04:09:03Z
```
import std;
void main() @safe @nogc
{
auto what = exfiltrate();
what();
}
auto exfiltrate() @safe @nogc
{
S2 s2;
s2.temp = &s2.s.foo;
return (s2.bar());
}
struct S2
{
S s;
void delegate() @safe @nogc temp;
auto bar() @safe @nogc
{
return temp;
}
}
struct S
{
int i = 42;
@nogc @safe ~this() { i = 0; }
void foo() @trusted @nogc
{
printf("ok %d", i);
}
}
```
This should not compile, it does and prints `ok 0`, meaning it got called on a dead object
Comment #1 by robert.schadek — 2024-12-13T19:20:14Z