Skip to content

[dcl.fct.def.coroutine] q1 in a lambda whose operator() is a coroutine #721

Open
@frederick-vs-ja

Description

@frederick-vs-ja

Full name of submitter (unless configured in github; will be published with the issue): Jiang An

Reference (section label): [dcl.fct.def.coroutine]

Link to reflector thread (if any):

Issue description:

CWG2465 clarified that the q1 is an lvalue that denotes *this for an implicit object member function. However, in a lambda expression whose operator() is an implicit object member function and a coroutine, *this doesn't denote the lambda closure object, and is possibly invalid (when neither this nor *this is captured).

Perhaps for a lambda expression we should specify q1 to be an lvalue that denotes the lambda closure object, and is const unless the lambda is mutable.

However, it seem that a captureless lambda should be handled as if the operator() is a static even if it's an implicit object member function. Otherwise, there would be behavioral difference between the operator() and the converted function pointer, as the latter can never have *this.

Suggested resolution:

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