Boost logo

Boost :

Subject: Re: [boost] [C++11] If you have an old class with a throwing destructor...
From: Nevin Liber (nevin_at_[hidden])
Date: 2013-09-09 12:15:05


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

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