co_await should be a single evaluation
Section [expr.await]
Gor Nishanov

Created on 2020-10-19.00:00:00 last changed 11 months ago


Date: 2020-10-19.00:00:00

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;

Suggested resolution:

Add the following as a new paragraph following [expr.await] paragraph 5:

With respect to an indeterminately-sequenced function call, the operation of co_await is a single evaluation. [Note: Therefore a function call cannot intervene between the subexpressions constituting evaluation of a co_await expression. —end note]

[Example 1:...

Date User Action Args
2020-10-19 00:00:00admincreate