From Jason Turner

[except.unexpected]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp96mo4bbw/{from.md → to.md} +0 -32
tmp/tmp96mo4bbw/{from.md → to.md} RENAMED
@@ -1,32 +0,0 @@
1
- ### The `std::unexpected()` function <a id="except.unexpected">[[except.unexpected]]</a>
2
-
3
- If a function with a *dynamic-exception-specification* throws an
4
- exception that is not listed in the * dynamic-exception-specification*,
5
- the function `std::unexpected()` is called ([[exception.unexpected]])
6
- immediately after completing the stack unwinding for the former
7
- function.
8
-
9
- By default, `std::unexpected()` calls `std::terminate()`, but a program
10
- can install its own handler function ([[set.unexpected]]). In either
11
- case, the constraints in the following paragraph apply.
12
-
13
- The `std::unexpected()` function shall not return, but it can throw (or
14
- re-throw) an exception. If it throws a new exception which is allowed by
15
- the exception specification which previously was violated, then the
16
- search for another handler will continue at the call of the function
17
- whose exception specification was violated. If it throws or rethrows an
18
- exception that the * dynamic-exception-specification* does not allow
19
- then the following happens: If the * dynamic-exception-specification*
20
- does not include the class `std::bad_exception` ([[bad.exception]])
21
- then the function `std::terminate()` is called, otherwise the thrown
22
- exception is replaced by an implementation-defined object of the type
23
- `std::bad_exception` and the search for another handler will continue at
24
- the call of the function whose * dynamic-exception-specification* was
25
- violated.
26
-
27
- Thus, a *dynamic-exception-specification* guarantees that only the
28
- listed exceptions will be thrown. If the
29
- * dynamic-exception-specification* includes the type
30
- `std::bad_exception` then any exception not on the list may be replaced
31
- by `std::bad_exception` within the function `std::unexpected()`.
32
-