Title
Throwing an exception from the destructor of a local static object
Status
cd2
Section
14.6.2 [except.terminate]
Submitter
Daniel Krügler

Created on 2007-12-16.00:00:00 last changed 171 months ago

Messages

Date: 2009-03-15.00:00:00

[Voted into the WP at the March, 2009 meeting.]

Date: 2008-09-15.00:00:00

Proposed resolution (September, 2008):

Change 14.6.2 [except.terminate] paragraph 1, fourth bullet as indicated, and add an additional bullet to follow it:

  • when construction or destruction of a non-local object with static or thread storage duration exits using an exception (6.9.3.2 [basic.start.static]), or

  • when destruction of an object with static or thread storage duration exits using an exception (6.9.3.3 [basic.start.dynamic]), or

Date: 2016-02-15.00:00:00

The destruction of local static objects occurs at the same time as that of non-local objects (6.9.3.3 [basic.start.dynamic] paragraph 1) and the execution of functions registered with std::atexit (paragraph 3). According to 14.6.2 [except.terminate] paragraph 1, std::terminate is called if a destructor for a non-local object or a function registered with std::atexit exits via an exception, but the Standard is silent about the result of throwing an exception from a destructor for a local static object. Presumably this is an oversight and the same rules should apply to destruction of local static objects.

History
Date User Action Args
2010-03-29 00:00:00adminsetstatus: wp -> cd2
2009-08-03 00:00:00adminsetstatus: dr -> wp
2009-03-23 00:00:00adminsetmessages: + msg2032
2009-03-23 00:00:00adminsetstatus: ready -> dr
2008-10-05 00:00:00adminsetstatus: review -> ready
2008-03-17 00:00:00adminsetmessages: + msg1595
2008-03-17 00:00:00adminsetstatus: open -> review
2007-12-16 00:00:00admincreate