The function std::terminate ([except.terminate])
is used by the exception
handling mechanism for coping with errors related to the exception handling
mechanism itself.
when the exception handling mechanism, after completing
the initialization of the exception object
but before
activation of a handler for the exception ([except.throw]),
calls a function that exits
via an exception, or
when the destructor or the move assignment operator is invoked on an object
of type std::thread that refers to a joinable thread
([thread.thread.destr], [thread.thread.assign]), or
In the situation where no matching handler is found, it is
implementation-defined whether or not the
stack is unwound
before
std::terminate
is called.
In the situation where the search for a handler encounters the
outermost block of a function
with a non-throwing exception specification, it is
implementation-defined
whether the stack is unwound, unwound partially, or not unwound at all
before the function std::terminate is called.
In all other situations, the stack shall not be unwound before
the function std::terminate
is called.
An implementation is not permitted to finish stack unwinding
prematurely based on a determination that the unwind process
will eventually cause a call to the function
std::terminate.
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]).