[cfe-dev] [LLVMdev] [LLVMDev] Object in a try-catch block not being destroyed even after an exception
Jordan Rose
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());
doSomethingElse();
}
…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.
Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120619/05ef2037/attachment.html>
More information about the cfe-dev
mailing list