This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
[Accepted as a DR at the June, 2021 meeting.]
The description of co_await should not permit reordering the subexpressions constituting the evaluation of a co_await expression. For example, given
auto z = co_await coro + co_await coro;
the result may be different from the expected
auto x = co_await coro; auto y = co_await coro; auto z = x + y;
Add the following as a new paragraph following 188.8.131.52 [expr.await] paragraph 5:
Proposed resolution, May, 2021:
Change 6.9.1 [intro.execution] paragraph 11 as follows:
callinga function (whether or not the function is inline), every value computation and side effect associated with anyargument expression , or withthe postfix expression designating the called function , issequenced before execution ofevery expression or statement in the body of the called function. For each function invocation F, for everyevaluation Athat occurswithin F and every evaluation B that does not occur within Fbut is evaluated on the same thread and as part of the same signal handler (if any) , either A is sequenced before B or B is sequenced before A.[Footnote: In other words, function executions do not interleave with each other. —end footnote] [Note 7: If A and B would not otherwise be sequenced then they are indeterminately sequenced. —end note]
Add the following note at the end of 184.108.40.206 [expr.await] paragraph 5:
The await-expression evaluates the (possibly-converted) o expression and the await-ready expression, then:
[Note: With respect to sequencing, an await-expression is indivisible (6.9.1 [intro.execution]). —end note]
Drafting note: No change is needed in 6.9.1 [intro.execution] paragraph 8:
...An expression X is said to be sequenced before an expression Y if every value computation and every side effect associated with the expression X is sequenced before every value computation and every side effect associated with the expression Y.
Additional note, May, 2021:
Note 7 in 6.9.1 [intro.execution] paragraph 11 refers to evaluations A and B, even though the edit to that paragraph above removes those names. This discrepancy was noticed only after CWG approved the change to the normative wording. Since it involves only the wording of a non-normative note, the problem will be addressed editorially. See editorial issue 4612.