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

2026-11-17


3239. Redundant specification for stack unwinding for std::terminate

Section: 14.4  [except.handle]     Status: review     Submitter: Yin Xinyu     Date: 2026-09-24

(From submission #1014.)

Subclause 14.4 [except.handle] paragraph 8 specifies:

If no matching handler is found, the function std::terminate is invoked; whether or not the stack is unwound before this invocation of std::terminate is implementation-defined (14.6.2 [except.terminate]).

However, this (and more) is already said in 14.6.2 [except.terminate] paragraph 2:

In the situation where no matching handler is found, it is implementation-defined whether or not the stack is unwound before std::terminate is invoked. ...

Suggested resolution [SUPERSEDED]:

Change in 14.4 [except.handle] paragraph 8 as follows:

If no matching handler is found, the function std::terminate is invoked; whether or not the stack is unwound before this invocation of std::terminate is implementation-defined (14.6.2 [except.terminate]).

CWG 2026-10-27

Pursue the opposite approach, i.e. 14.6.2 [except.terminate] should be turned into a notes.

Proposed resolution:

  1. Change in 14.4 [except.handle] paragraph 7 as follows:

    If the search for a handler exits the function body of a function with a non-throwing exception specification, the function std::terminate (14.6.2 [except.terminate]) is invoked; whether the stack is unwound, unwound partially, or not unwound at all before this invocation of std::terminate is implementation-defined. ...
  2. Change in 14.4 [except.handle] paragraph 8 as follows:

    If no matching handler is found, the function std::terminate (14.6.2 [except.terminate]) is invoked; whether or not the stack is unwound before this invocation of std::terminate is implementation-defined (14.6.2 [except.terminate]).
  3. Change in 14.6.2 [except.terminate] paragraph 2 as follows:

    In the situation where no matching handler is found, it is implementation-defined whether or not the stack is unwound before std::terminate is invoked. In the situation where the search for a handler (14.4 [except.handle]) exits the function body of a function with a non-throwing exception specification (14.5 [except.spec]), it is implementation-defined whether the stack is unwound, unwound partially, or not unwound at all before the function std::terminate is invoked. In all other situations, Unless otherwise specified (14.4 [except.handle]), the stack shall not be unwound before the function std::terminate is invoked. An implementation is not permitted to finish stack unwinding prematurely based on a determination that the unwind process will eventually cause an invocation of the function std::terminate.