Skip to content

CWG3138 [expr.prim.id.unqual] name of coroutine parameter copy inside a lambda #674

Description

@t3nsor

Full name of submitter: Brian Bi

Issue description: After P2900R14, in cases where [expr.prim.id.unqual]/3+a applies, we do not fall through to 3+b, which says that the result of the unqualified-id is the parameter copy. Therefore, the result now refers to the original parameter.

Suggested resolution: We should keep all the description of what entity the unqualified-id refers to in p3.

Edit [expr.prim.id.unqual]/3:

The result is the entity denoted by the unqualified-id ([basic.lookup.unqual]), except that if that entity is a coroutine parameter, the result is instead the copy of that parameter ([dcl.fct.def.coroutine]).

Edit [expr.prim.id.unqual]/3+b:

Otherwise, if the unqualified-id names entity is the copy of a coroutine parameter, the type of the expression is that of the copy of the parameter ([dcl.fct.def.coroutine]), and the result is that copy. the type of the entity.

Activity

  1. t3nsor commented on Nov 26, 2025

    @t3nsor
    Author

    Here is some new wording, rebased on the current draft, that also resolves https://lists.isocpp.org/core/2025/02/17328.php

    Edit [expr.prim.id.unqual]/3:

    The result is the entity denoted by the unqualified-id ([basic.lookup.unqual]), except that if that entity is a parameter declared in the function parameter scope associated with a coroutine definition, the result is instead the copy of that parameter ([dcl.fct.def.coroutine]).

    Move [expr.prim.id.unqual]/7 immediately after p3 and edit it as follows:

    Otherwise, ifIf the unqualified-id appears in the predicate of a contract assertion C ([basic.contract]) and the entityresult is

    • a variable declared outside of C of object type T,
    • a variable or template parameter of reference type declared outside of C of type “reference to T”, or
    • a structured binding of type T whose corresponding variable is declared outside of C,

    then the type of the expression is const T , where T is the type that the expression would otherwise have according to the rules below.

    Edit [expr.prim.id.unqual]/5:

    Otherwise, if the unqualified-id names result is the copy of a coroutine parameter, the type of the expression is that of the copy of the parameter ([dcl.fct.def.coroutine]), and the result is that copy. the type of the result.

  2. t3nsor commented on Nov 26, 2025

    @t3nsor
    Author

    Actually, p5 may not be needed anymore after the other changes.

  3. jensmaurer commented on Nov 30, 2025

    @jensmaurer
    Member
  4. changed the title [-][expr.prim.id.unqual] name of coroutine parameter copy inside a lambda[/-] [+]CWG3138 [expr.prim.id.unqual] name of coroutine parameter copy inside a lambda[/+] on Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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