Description
Full name of submitter (unless configured in github; will be published with the issue): Jim X
[expr.await] p2 says
An await-expression shall appear only in a potentially-evaluated expression within the compound-statement of a function-body outside of a handler ([except.pre]).
Consider this example
auto f = []()->Task{
co_await Awaitable{};
}
Grammarly, the await-expression appears in the compound-statement of a lambda-expression rather than the compound-statement of a function-body, even if [expr.prim.lambda.closure] p13
The lambda-expression's compound-statement yields the function-body ([dcl.fct.def]) of the function call operator, but it is not within the scope of the closure type.
Anyway, they are not equivalent in grammar.
Suggested resolution
An await-expression shall appear only in a potentially-evaluated expression within:
- the compound-statement of a function-body outside of a handler ([except.pre]), or
- the compound-statement of a lambda-expression