Skip to content

Commit da92321

Browse files
committed
CWG2466 co_await should be a single evaluation
1 parent 8a70399 commit da92321

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

source/basic.tex

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5674,24 +5674,26 @@
56745674
\end{example}
56755675

56765676
\pnum
5677-
When calling a function (whether or not the function is inline), every
5678-
\indextext{value computation}%
5679-
value computation and
5680-
\indextext{side effects}%
5681-
side effect associated with any argument
5682-
expression, or with the postfix expression designating the called
5683-
function, is sequenced before execution of every expression or statement
5677+
When invoking a function (whether or not the function is inline),
5678+
every argument expression and
5679+
the postfix expression designating the called function
5680+
are sequenced before every expression or statement
56845681
in the body of the called function.
5685-
For each function invocation \placeholder{F},
5686-
for every evaluation \placeholder{A} that occurs within \placeholder{F} and
5687-
every evaluation \placeholder{B} that does not occur within \placeholder{F} but
5688-
is evaluated on the same thread and as part of the same signal handler (if any),
5689-
either \placeholder{A} is sequenced before \placeholder{B} or
5690-
\placeholder{B} is sequenced before \placeholder{A}.
5682+
For each function invocation or
5683+
evaluation of an \grammarterm{await-expression} \placeholder{F},
5684+
each evaluation that does not occur within \placeholder{F} but
5685+
is evaluated on the same thread and as part of the same signal handler (if any)
5686+
is either sequenced before all evaluations that occur within \placeholder{F}
5687+
or sequenced after all evaluations that occur within \placeholder{F};
56915688
\begin{footnote}
56925689
In other words,
56935690
function executions do not interleave with each other.
56945691
\end{footnote}
5692+
if \placeholder{F} invokes or resumes a coroutine\iref{expr.await},
5693+
only evaluations
5694+
subsequent to the previous suspension (if any) and
5695+
prior to the next suspension (if any)
5696+
are considered to occur within \placeholder{F}.
56955697
\begin{note}
56965698
If \placeholder{A} and \placeholder{B} would not otherwise be sequenced then they are
56975699
indeterminately sequenced.

source/expressions.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4609,6 +4609,10 @@
46094609
the \placeholder{await-resume} expression is evaluated, and
46104610
its result is the result of the \grammarterm{await-expression}.
46114611
\end{itemize}
4612+
\begin{note}
4613+
With respect to sequencing,
4614+
an \grammarterm{await-expression} is indivisible\iref{intro.execution}.
4615+
\end{note}
46124616

46134617
\pnum
46144618
\begin{example}

0 commit comments

Comments
 (0)