void unexpected();
[[noreturn]] void unexpected();
Function handling unexpected exceptions
Calls the current unexpected handler.

By default, the unexpected handler calls terminate. But this behavior can be redefined by calling set_unexpected.

This function is automatically called when a function throws an exception that is not listed in its dynamic-exception-specifier (i.e., in its throw specifier).

This function is provided so that the unexpected handler can be explicitly called by a program, and works even if set_unexpected has not been used to set a custom unexpected handler (calling terminate in this case).

Return value



The use of dynamic-exception-specifiers is deprecated (since C++11).

Exception safety

Throws an exception if it does not terminate execution of the program.

See also