As reported by Tomer Filiba:
@safe:
struct S {
@safe:
int x;
auto foo() {return &bar;}
void bar() {x = 999;}
}
auto f() {
auto s = S(100);
return s.foo();
}
void main() {
auto dg = f();
dg(); // i now have a delegate that will write 999 to some random stack location
}