What is going on here?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 4 07:43:16 PST 2015

On 3/4/15 8:43 AM, Shachar Shemesh wrote:

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

I believe destructors are not run when you throw inside a constructor. 
So plan to deallocate if the ctor throws:

a = A(var + 1);
scope(failure) destroy(a);


More information about the Digitalmars-d mailing list