|
Boost : |
Subject: Re: [boost] Updated boost::base_from_member for C++2011
From: Daryle Walker (darylew_at_[hidden])
Date: 2012-02-21 18:26:23
> Date: Tue, 21 Feb 2012 20:47:33 +0900
> From: Michel
>
> Michel Morin wrote:
> > Ah, I see what I was missing. As Daryle said,
> > the destruction of a MemberType temporary is invoked in noexcept operator.
> > I didn't notice this, because clang does not evaluate the destructor.
>
> Sorry, this is incorrect.
> Clang **does** checking the destructor in noexcept operator.
>
> I didn't know of N3204 (deducing noexcept for destructors),
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3204.htm
> and I made a wrong comment on clang's noexcept operator.
>
> As per N3204 (clang already implemented this),
> with the following type
>
> struct type
> {
> type() noexcept;
> ~type() { throw 0; }
> };
>
> `noexcept(type())` should return true,
> despite the fact that the destructor throws.
Explicitly adding a "noexcept(false)" to the destructor (which may be a good idea)
would change "noexcept(type())" to false, right? The global-void*-new method should
never consider the destructor in noexcept evalutations.
(I originally had "never considers" instead of "should never consider," but I don't know
how delegating constructors interact with new. If a new call craps out during the constructor
phase, the destructor shouldn't be called, since the object was never fully initiated.
But that's not the case with delegating constructors; they're complete as soon as the
first (non-delegating?) sibling call completes. Does anyone know the C++11 policy on
these interactions?)
Daryle W.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk