This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-08-11
2556. Unusable promise::return_voidSection: 8.8.5 [stmt.return.coroutine] Status: DRWP Submitter: Davis Herring Date: 2022-03-24[Accepted as a DR at the November, 2023 meeting.]
Subclause 8.8.5 [stmt.return.coroutine] paragraph 3 specifies:
If p.return_void() is a valid expression, flowing off the end of a coroutine's function-body is equivalent to a co_return with no operand; otherwise flowing off the end of a coroutine's function-body results in undefined behavior.
However, 9.6.4 [dcl.fct.def.coroutine] paragraph 6 suggests:
If searches for the names return_void and return_value in the scope of the promise type each find any declarations, the program is ill-formed. [Note: If return_void is found, flowing off the end of a coroutine is equivalent to a co_return with no operand. Otherwise, flowing off the end of a coroutine results in undefined behavior (8.8.5 [stmt.return.coroutine]). —end note]
The difference is between the conditions "valid expression" and "found by name lookup". Effectively, it means that undefined behavior might result where the implementation could instead diagnose an ill-formed use of return_void (for example, because it is inaccessible, deleted, or the function call requires arguments).
Proposed resolution (approved by CWG 2023-06-17):
Change in 8.8.5 [stmt.return.coroutine] paragraph 3 as follows:
If p.return_void() is a valid expression a search for the name return_void in the scope of the promise type finds any declarations, flowing off the end of a coroutine's function-body is equivalent to a co_return with no operand; otherwise flowing off the end of a coroutine's function-body results in undefined behavior.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4