Title
Implicit lambda capture via explicit copy constructor
Status
nad
Section
7.5.5.3 [expr.prim.lambda.capture]
Submitter
FI

Created on 2010-08-02.00:00:00 last changed 166 months ago

Messages

Date: 2010-08-15.00:00:00

Rationale (August, 2010):

The behavior is according to the original design and is similar to what would happen if the constructor of the closure object initialized the members for the captured entities using mem-initializers. CWG did not see sufficient motivation to change the design.

Date: 2022-11-20.07:54:16
N3092 comment FIĀ 19

According to 7.5.5 [expr.prim.lambda] paragraph 21,

When the lambda-expression is evaluated, the entities that are captured by copy are used to direct-initialize each corresponding non-static data member of the resulting closure object.

This apparently means that if the capture-default is to copy, entities captured by default, implicitly, are copied even in cases where the copy constructors of such entities are explicit. It should be required that such entities be captured explicitly instead.

See also issue 1020.

History
Date User Action Args
2010-08-23 00:00:00adminsetmessages: + msg2942
2010-08-02 00:00:00admincreate