We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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.
j
The correct code should be:
int j; auto x3 = [&]()->auto&& { return j; }; // OK: return type is int& ^
I think j should be interpreted as having namespace scope, so it needn't (and can't) be captured.
My bad., I wrongly reproduced the example with j in a local scope.
Activity
cpplearner commentedon Jan 29, 2016
I think
j
should be interpreted as having namespace scope, so it needn't (and can't) be captured.t-lutz commentedon Jan 29, 2016
My bad., I wrongly reproduced the example with
j
in a local scope.[-]Missing capture default in example 5.1.2.4[/-][+][expr.prim.lambda] Missing capture default in example 5.1.2.4[/+]