scope attribute and catching exception

Paolo Invernizzi arathorn at
Mon Oct 13 03:05:59 PDT 2008

Denis Koroskin Wrote:

> Looks like no destructor is called if ctor throws an exception.
> Try throwing outside of it and see what happens.

In that case everything is ok. So it's a bug?

    // In this case everything it's ok
        try {
            scope r1 = new Resource();
            scope r2 = new Resource();
            throw new Exception("bang");
        catch(Exception e){}
    assert( Resource.allocated == 0); // Expected

More information about the Digitalmars-d-learn mailing list