Boost logo

Boost :

Subject: Re: [boost] [C++11] If you have an old class with a throwing destructor...
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2013-09-09 12:41:07


Your analysis is correct, but in practice the problem described by Daryle
still exists. Authors of classes that throw in destructors need to take
some action if they have written their libraries in C++03: either mark
destructors as noexcept(false) or embed a sub-object (member or base class)
that has a noexcept(false) destructor.
Regards,
&rzej

2013/9/9 Nevin Liber <nevin_at_[hidden]>

> On 7 September 2013 08:22, Daryle Walker <darylew_at_[hidden]> wrote:
>
> > I just got reminded of a breaking change in C++11 regarding this.
> > Destructors without any exception specification in C++11 get
> > `noexcept(true)` added to them.
>
>
> That isn't the rule. It is actually:
>
> n3290 12.4p3 Destructors:
>
> A declaration of a destructor that does not have an
> *exception-specification
> *is implicitly considered to have
>
> the same *exception-specification *as an implicit declaration
>
>
> n3290 15.4p14 Exception specifications:
>
> If f is
>
> an implicitly declared default constructor, copy constructor, move
> constructor, destructor, copy assignment
>
> operator, or move assignment operator, its implicit
> *exception-specification
> *specifies the *type-id *T if and only
>
> if T is allowed by the *exception-specification *of a function directly
> invoked by f’s implicit definition; f shall
>
> allow all exceptions if any function it directly invokes allows all
> exceptions, and f shall allow no exceptions
>
> if every function it directly invokes allows no exceptions.
>
> --
> Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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