|| (until C++11)
[[noreturn]] void terminate();
|| (since C++11)
std::terminate() is called by the C++ runtime when exception handling fails for any of the following reasons:
an exception is thrown
and not caught (it is implementation-defined whether any stack unwinding is done in this case)
2) an exception is thrown during exception handling (e.g. from a destructor of some local object, or from a function that had to be called during exception handling)
3) the constructor or the destructor of a static or thread-local object throws an exception
a noexcept specification
is violated (it is implementation-defined whether any stack unwinding is done in this case)
a non-default handler for std::unexpected
throws an exception that violates the previously violated dynamic exception specification, if the specification does not include std::bad_exception
8) std::nested_exception::rethrow_nested is called for an object that isn't holding a captured exception
an exception is thrown from the initial function of std::thread
std::terminate() may also be called directly from the program.
In any case,
std::terminate calls the currently installed std::terminate_handler. The default std::terminate_handler calls std::abort.
If a destructor reset the terminate handler during stack unwinding and the unwinding later led to
terminate being called, the handler that was installed at the end of the throw expression is the one that will be called. (note: it was ambiguous whether re-throwing applied the new handlers)
If a destructor reset the terminate handler during stack unwinding, it is unspecified which handler is called if the unwinding later led to
terminate being called.
 Return value
 See also