This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


668. Throwing an exception from the destructor of a local static object

Section: 14.6.2  [except.terminate]     Status: CD2     Submitter: Daniel Krügler     Date: 16 December 2007

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

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.

Proposed resolution (September, 2008):

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