This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Adopted at the February, 2016 meeting.]
According to 8.7.4 [stmt.return] paragraph 2,
Flowing off the end of a function is equivalent to a return with no value...
This is not correct, since a return with no value is ill-formed in a value-returning function but flowing off the end results in undefined behavior.
Proposed resolution (May, 2015): [SUPERSEDED]
Change 8.7.4 [stmt.return] paragraph 2 as follows:
...Flowing off the end of a value-returning function is undefined behavior. Flowing off the end of any other function is equivalent to a return with no value; this results in undefined behavior in a value-returning function.
Additional notes, October, 2015:
There is similar wording in 14.4 [except.handle] paragraph 14. Also, it might be better to avoid the use of the word “value”, since it is currently not clearly defined.
Proposed resolution (October, 2015):
Change 6.9.3.1 [basic.start.main] paragraph 5 as follows:
A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage duration) and calling std::exit with the return value as the argument. If control
reachesflows off the end of the compound-statement of mainwithout encountering a return statement, the effect isthat of executingequivalent to a return with operand 0 (see also 14.4 [except.handle]).return 0;
Change 8.7.4 [stmt.return] paragraph 2 as follows:
...Flowing off the end of a function with a void return type is equivalent to a return with novalue; this results in undefined behavior in a value-returning functionoperand. Otherwise, flowing off the end of a function other than main (6.9.3.1 [basic.start.main] results in undefined behavior.
Change 14.4 [except.handle] paragraph 14 as follows:
The currently handled exception is rethrown if control reaches the end of a handler of the function-try-block of a constructor or destructor. Otherwise,a function returns when control reaches the end of a handler for the function-try-block (8.7.4 [stmt.return]). Flowing off the end of a function-try-block is equivalent to a return with no value; this results in undefined behavior in a value-returning function (8.7.4 [stmt.return])flowing off the end of the compound-statement of a handler of a function-try-block is equivalent to flowing off the end of the compound-statement of that function (see 8.7.4 [stmt.return]).