Created on 2022-04-06.00:00:00 last changed 17 months ago
Additional notes (January, 2023)
See also clang bug report #56532.
Forwarded to EWG with paper issue 1414, by decision of the CWG chair.
EWG 2023-02-06
EWG agrees that get_return_object is invoked outside of the try-block and that, if a conversion is needed, the return value of get_return_object is considered an xvalue that is later converted to the result object.
Suggested resolution [SUPERSEDED]:
Change in 9.5.4 [dcl.fct.def.coroutine] paragraph 7 as follows:
The expression promise.get_return_object() is used to initialize theThe returned reference or prvalue result object of a call to a coroutine is copy-initialized with promise.get_return_object(). Thecall to get_return_objectinitialization is sequenced before the call to initial-suspendand is invoked at most once.
Subclause 9.5.4 [dcl.fct.def.coroutine] paragraph 7 specifies:
The expression promise.get_return_object() is used to initialize the returned reference or prvalue result object of a call to a coroutine. The call to get_return_object is sequenced before the call to initial-suspend and is invoked at most once.
It is unclear:
There is implementation divergence.
Note that a user-defined conversion may be involved in the initialization of the coroutine's prvalue result object from get_return_object(). Note also that the return type of get_return_object might be non-copyable and non-movable. However, there are certain programming patterns that would benefit from a late-initialized return value.
See also compiler explorer.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-06-20 07:07:03 | admin | set | status: open -> drafting |
2023-01-05 08:22:04 | admin | set | messages: + msg7106 |
2022-04-06 15:19:39 | admin | set | messages: + msg6790 |
2022-04-06 00:00:00 | admin | create |