std::unexpected

Header: <exception>

std::unexpected() is called by the C++ runtime when a dynamic exception specification is violated: an exception is thrown from a function whose exception specification forbids exceptions of this type.

# Declarations

void unexpected();

(until C++11)

[[noreturn]] void unexpected();

(deprecated in C++11) (removed in C++17)

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2111C++11effect of calling std::set_unexpected during stackunwinding differs from C++98 and breaks some ABIsmade unspecified

# See also