Created on 2022-03-24.00:00:00 last changed 8 months ago
Proposed resolution (approved by CWG 2023-06-17):
Change in 8.7.5 [stmt.return.coroutine] paragraph 3 as follows:
Ifp.return_void() is a valid expressiona 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.
[Accepted as a DR at the November, 2023 meeting.]
Subclause 8.7.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.5.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.7.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).
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-04-05 21:43:46 | admin | set | status: dr -> drwp |
2023-12-19 10:15:28 | admin | set | status: ready -> dr |
2023-11-10 14:27:11 | admin | set | status: tentatively ready -> ready |
2023-06-20 06:44:53 | admin | set | status: open -> tentatively ready |
2022-03-24 17:54:43 | admin | set | messages: + msg6776 |
2022-03-24 00:00:00 | admin | create |