A coroutine returns to its caller or resumer by the co_return statement or when suspended. [...]
These definition borders on saying nothing, because it's unclear what returning means. By comparison, in [dcl.fct.def.coroutine] p10 we see better wording:
[...] the coroutine returns control to the caller of the coroutine [...]
It's also strange to state that co_await returns to the caller inside the definition of co_return. The explanation of co_await's effect on control flow should be self-contained in [expr.await], and not be a quasi-note in another section.
Suggested resolution
Transfer of control is relatively common terminology in the standard. It should be used consistently for return statements, suspensions, etc.
Update [stmt.return] p1:
-A function returns to its caller by the return statement.
+A return statement transfers control to the caller of the function.
Update [stmt.return.coroutine] p1:
-A coroutine returns to its caller or resumer by the co_return statement or when suspended.
+A co_return statement transfers control to the caller or resumer of the coroutine.
[...]
Update [dcl.fct.def.coroutine] p10:
[...] the coroutine
-returns
+transfers
control to the caller of the coroutine [...]
Update [expr.await] p1:
The co_await expression is used to suspend evaluation of a coroutine
while awaiting completion of the computation represented by the operand expression.
+Suspending the evaluation of a coroutine transfers control to its caller or resumer.
Reference: [stmt.return] p1, [stmt.return.coroutine] p1
Issue Description
[stmt.return] p1 states:
[stmt.return] p1 states:
These definition borders on saying nothing, because it's unclear what returning means. By comparison, in [dcl.fct.def.coroutine] p10 we see better wording:
It's also strange to state that
co_await
returns to the caller inside the definition ofco_return
. The explanation ofco_await
's effect on control flow should be self-contained in [expr.await], and not be a quasi-note in another section.Suggested resolution
Transfer of control is relatively common terminology in the standard. It should be used consistently for return statements, suspensions, etc.
Update [stmt.return] p1:
Update [stmt.return.coroutine] p1:
Update [dcl.fct.def.coroutine] p10:
Update [expr.await] p1: