Title
init-captures and nested lambdas
Status
c++14
Section
7.5.6.3 [expr.prim.lambda.capture]
Submitter
Richard Smith

Created on 2013-05-14.00:00:00 last changed 121 months ago

Messages

Date: 2013-09-15.00:00:00

Proposed resolution (September, 2013):

This issue is resolved by the resolution of issue 1760.

Date: 2014-02-15.00:00:00

[Applied to WP at the February, 2014 meeting.]

According to 7.5.6 [expr.prim.lambda] paragraph 10,

The identifier in a simple-capture is looked up using the usual rules for unqualified name lookup (6.5.3 [basic.lookup.unqual]); each such lookup shall find a variable with automatic storage duration declared in the reaching scope of the local lambda expression.

This does not permit a nested lambda to capture the non-static data member of the closure type introduced by an init-capture. A similar restriction applies to implicit capture in paragraph 12.

Presumably such captures should be allowed, capturing the non-static data member directly rather than the this pointer from the enclosing lambda's operator().

History
Date User Action Args
2014-11-24 00:00:00adminsetstatus: accepted -> c++14
2014-03-03 00:00:00adminsetstatus: ready -> accepted
2013-10-14 00:00:00adminsetmessages: + msg4577
2013-10-14 00:00:00adminsetstatus: open -> ready
2013-05-14 00:00:00admincreate