Annex F (informative)
Core undefined behavior
[ub]
F.4
[stmt]
: Statements
[ub.stmt]
F.4.1
[ub:stmt.return.flow.off]
Specified in:
[stmt.
return]
1
#
Flowing off the end of a function other than
main
or a coroutine results in undefined behavior if the return type is not
cv
void
.
2
#
[
Example
1
:
int
f
(
int
x
)
{
if
(
x
)
return
1
;
// undefined behavior if
x
is
0
}
void
b
(
)
{
int
x
=
f
(
0
)
;
// undefined behavior, using
0
as an argument will cause
f(...)
to flow
// off the end without a
return
statement
}
—
end example
]