xxxxxxxxxx
void main()
{
import std.stdio : writeln;
static struct Foo
{
bool exists = true;
~this() { exists = false; }
void doStuff() { assert(exists); }
}
Foo* p;
scope(exit) (*p).doStuff;
Foo f;
scope(exit) destroy(f);
p = &f;
}