Hi! I've been trying out D recently but I'm a little confused about the order 
in which destructors are called:

class A {
        this() { writeln("ctor"); }
        ~this() { writeln("dtor"); }

        static this() { writeln("static ctor"); }
        static ~this() { writeln("static dtor"); }
}

void main() {
        auto a = new A;
}

This will output:
static ctor
ctor
static dtor
dtor

I would have thought that the static destructor should be the last one (in case 
there are static dependencies). Have I missed something?

/Albin

Reply via email to