std::unexpected - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::unexpected

From cppreference.com
< cpp‎ | error

Defined in header `<exception>` |  |

void unexpected(); |  | (until C++11)
[[noreturn]] void unexpected(); |  | (since C++11) (deprecated)

`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.

`std::unexpected()` may also be called directly from the program.

In either case, `std::unexpected` calls the currently installed std::unexpected_handler. The default std::unexpected_handler calls std::terminate.

### [edit] Parameters

(none)

### [edit] Return value

(none)

### [edit] Exceptions

Throw any exception thrown by the currently installed std::unexpected_handler

### [edit] See also

unexpected_handler (deprecated) | the type of the function called by std::unexpected (typedef) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/error/unexpected&oldid=72173"