Movatterモバイル変換


[0]ホーム

URL:


Issue 2095 - WG21 CWG Issues
Title
Capturing rvalue references to functions by copy
Status
cd4
Section
7.5.6.3 [expr.prim.lambda.capture]
Submitter
Hubert Tong

Created on2015-03-07.00:00:00 last changed109 months ago

Messages

msg5594 (view)
Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015):

Change 7.5.6 [expr.prim.lambda] paragraph 15 as follows:

An entity iscaptured by copy if it is implicitly captured andthecapture-default is= or if it is explicitly capturedwith a capture that is not of the form&identifier or&identifier initializer. For each entity captured bycopy, an unnamed non-static data member is declared in the closuretype. The declaration order of these members is unspecified. The type ofsuch a data member isthe referenced type if the entity is a referenceto an object, an lvalue reference to the referenced function type if theentity is a reference to a function, or the type of the correspondingcaptured entityif the entity is not a reference to an object, or thereferenced type otherwise.[Note: If the captured entityis a reference to a function, the corresponding data member is also areference to a function. —end note] A member of ananonymous union shall not be captured by copy.
msg5491 (view)
Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

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

An entity is captured by copy if it is implicitly capturedand thecapture-default is= or if it is explicitlycaptured with a capture that is not of the form &identifier or&identifierinitializer. For each entitycaptured by copy, an unnamed non-static data member isdeclared in the closure type. The declaration order of thesemembers is unspecified. The type of such a data member isthe type of the corresponding captured entity if the entityis not a reference to an object, or the referenced typeotherwise.

It's not clear how to handle capture by copy when theentity is an rvalue reference to function. In particular,this appears to be a contradiction with 7.5.6 [expr.prim.lambda] paragraph 3,

An implementation shall not add members of rvalue referencetype to the closure type.
History
DateUserActionArgs
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: +msg5594
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2015-03-07 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp