Boost logo

Boost :

Subject: Re: [boost] Updated boost::base_from_member for C++2011
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-02-18 22:48:13


Michel Morin wrote:
> Daryle Walker wrote:
>> However, every operation required for a noexcept expression is considered,
>> including any destructor calls for temporary objects.
>> That's why there's a "declval," after all.
>> We need to call a constructor without a corresponding destructor,
>> and the placement-new syntax (in a no-throw version) does that.
>> The variant used is one of the few that's illegal to override.
>
> In `MemberType(static_cast<T&&>(x)…)`,
> I don't see any any destruction of temporaries, since there are
> no temporaries involved in `static_cast<T&&>(x)…`.
> Maybe I'm missing something. Could you elaborate on this?

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.

Thanks,
Michel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk