22
General utilities library
[utilities]
22.2
Utility components
[utility]
22.2.9
Undefined behavior
[utility.undefined]
π
[
[
noreturn
]
]
void
unreachable
(
)
;
1
#
Preconditions
:
false
is
true
.
[
Note
1
:β
This precondition cannot be satisfied, thus the behavior of calling
unreachable
is undefined
.
β
end note
]
2
#
[
Example
1
:β
int
f
(
int
x
)
{
switch
(
x
)
{
case
0
:
case
1
:
return
x;
default
:
std
::
unreachable
(
)
;
}
}
int
a
=
f
(
1
)
;
// OK,
a
has value
1
int
b
=
f
(
3
)
;
// undefined behavior
β
end example
]
π
void
observable_checkpoint
(
)
noexcept
;
3
#
Effects
: Establishes an observable checkpoint (
[intro.
abstract]
)
.