xxxxxxxxxx
import std.stdio;
scope class A
{
this() { writeln("A.this()"); }
~this() { writeln("A.~this()"); }
void method() { writeln("A.method()"); }
}
A fun()
{
writeln("entering fun()");
auto a = new A;
writeln("leaving fun()");
return a;
// a.~this() called here
}
void main(string[] args)
{
auto a = fun();
// a.~this() has already been called, so the
// call to a.method() is undefined behavior
a.method();
}