Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CWG2668 [expr.await] await-expression is forbidden to appear in the lambda-expression #195

Copy link
Copy link
Closed
cplusplus/draft
#6906
cplusplus/draft#6906
@xmh0511

Description

@xmh0511
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.