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& ^ ```
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[/+]