tmp/tmpa025h7ga/{from.md → to.md}
RENAMED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
### Function `unreachable` <a id="utility.unreachable">[[utility.unreachable]]</a>
|
| 2 |
-
|
| 3 |
-
``` cpp
|
| 4 |
-
[[noreturn]] void unreachable();
|
| 5 |
-
```
|
| 6 |
-
|
| 7 |
-
*Preconditions:* `false` is `true`.
|
| 8 |
-
|
| 9 |
-
[*Note 1*: This precondition cannot be satisfied, thus the behavior of
|
| 10 |
-
calling `unreachable` is undefined. — *end note*]
|
| 11 |
-
|
| 12 |
-
[*Example 1*:
|
| 13 |
-
|
| 14 |
-
``` cpp
|
| 15 |
-
int f(int x) {
|
| 16 |
-
switch (x) {
|
| 17 |
-
case 0:
|
| 18 |
-
case 1:
|
| 19 |
-
return x;
|
| 20 |
-
default:
|
| 21 |
-
std::unreachable();
|
| 22 |
-
}
|
| 23 |
-
}
|
| 24 |
-
int a = f(1); // OK, a has value 1
|
| 25 |
-
int b = f(3); // undefined behavior
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
— *end example*]
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|