14 Exception handling [except]

14.6 Special functions [except.special]

14.6.1 General [except.special.general]

The function std​::​terminate ([except.terminate]) is used by the exception handling mechanism for coping with errors related to the exception handling mechanism itself.
The function std​::​current_­exception() and the class std​::​nested_­exception can be used by a program to capture the currently handled exception.

14.6.2 The std​::​terminate function [except.terminate]

In some situations exception handling is abandoned for less subtle error handling techniques.
[Note 1:
These situations are:
— end note]
In such cases, the function std​::​terminate is invoked ([exception.terminate]).
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 ([except.handle]) encounters the outermost block of a function with a non-throwing exception specification ([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, 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.

14.6.3 The std​::​uncaught_­exceptions function [except.uncaught]

An exception is considered uncaught after completing the initialization of the exception object until completing the activation of a handler for the exception ([except.handle]).
[Note 1:
As a consequence, an exception is considered uncaught during any stack unwinding resulting from it being thrown.
— end note]
If an exception is rethrown ([expr.throw], [propagation]), it is considered uncaught from the point of rethrow until the rethrown exception is caught.
The function std​::​uncaught_­exceptions ([uncaught.exceptions]) returns the number of uncaught exceptions in the current thread.