Title
co_await should be a single evaluation
Status
drafting
Section
7.6.2.4 [expr.await]
Submitter
Gor Nishanov

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

Messages

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 7.6.2.4 [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:...

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