Skip to content

[expr.prim.lambda] Missing capture default in example 5.1.2.4 #609

@t-lutz

Description

@t-lutz

The last two lines of the example read:

int j;
auto x3 = []()->auto&& { return j; }; // OK: return type is int&

However j is not captured and the lambda doesn't have a default capture.

The correct code should be:

int j;
auto x3 = [&]()->auto&& { return j; }; // OK: return type is int&
           ^

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