import std.stdio;

struct A {
    int a = 3;

    this( int var ) {
        a += var;
    }

    ~this() {
        writeln("A down ", a);
    }
}

struct B {
    A a;

    this( int var ) {
        a = A(var+1);
        throw new Exception("An exception");
    }
}

void main()
{
    try {
        auto b = B(2);
    } catch( Exception ex ) {
    }
}

I'd expect A's destructor to run, which does not seem to be the case.

Compiled with dmd 2.066.1

Shachar

Reply via email to