[cfe-dev] [LLVMdev] [LLVMDev] Object in a try-catch block not being destroyed even after an exception
jordan_rose at apple.com
Tue Jun 19 18:30:21 PDT 2012
On Jun 19, 2012, at 18:25 , Richard Smith <richard at metafoo.co.uk> wrote:
>> I believe the intent of the standard is quite clearly to have the local
>> variable destroyed in reverse order of construction w.r.t. the temporaries,
>> much like a return value must be.
> That does not match my expectation, which is that in:
> S s(T(), T());
> the T temporaries should *always* be destroyed before the S object is.
To take this a step further, if the code looked like this:
S s(T(), T());
…the S object should not be destroyed until doSomethingElse() finishes. The T objects, OTOH, will be destroyed at the end of the S object's decl statement (or thereabouts).
But if I /remove/ the call to doSomethingElse(), suddenly the S object is destroyed first?
I like John's interpretation, it's very cute, but it doesn't really match up with my actual expectations.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev