Title
Move constructor/assignment for closure class
Status
cd4
Section
7.5.5 [expr.prim.lambda]
Submitter
Jonathan Caves

Created on 2014-03-10.00:00:00 last changed 49 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-10-15.00:00:00

Proposed resolution (October, 2014):

Change 7.5.5 [expr.prim.lambda] paragraph 20 as follows:

The closure type associated with a lambda-expression has a deleted (9.5.3 [dcl.fct.def.delete]) no default constructor and a deleted copy assignment operator. It has an implicitly-declared a defaulted copy constructor (_N4750_.15.8 [class.copy]) and may have an implicitly-declared and a defaulted move constructor (_N4750_.15.8 [class.copy]). [Note: The copy/move constructor is implicitly defined in the same way as any other implicitly declared copy/move constructor would be implicitly defined These special member functions are implicitly defined as usual, and might therefore be defined as deleted. —end note]
Date: 2020-12-15.00:00:00

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

The closure type associated with a lambda-expression has a deleted (9.5.3 [dcl.fct.def.delete]) default constructor and a deleted copy assignment operator. It has an implicitly-declared copy constructor (_N4750_.15.8 [class.copy]) and may have an implicitly-declared move constructor (_N4750_.15.8 [class.copy]).

However, according to _N4750_.15.8 [class.copy] paragraph 9,

If the definition of a class X does not explicitly declare a move constructor, one will be implicitly declared as defaulted if and only if

  • X does not have a user-declared copy constructor,

  • X does not have a user-declared copy assignment operator,

  • X does not have a user-declared move assignment operator, and

  • X does not have a user-declared destructor.

It is not clear how this applies to the closure class. Would it be better to state that the closure class has a defaulted move constructor and a defaulted move assignment operator? There is already wording that handles the case if they are ultimately defined as deleted.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5339
2014-11-24 00:00:00adminsetstatus: tentatively ready -> dr
2014-10-13 00:00:00adminsetmessages: + msg5130
2014-10-13 00:00:00adminsetstatus: drafting -> tentatively ready
2014-07-07 00:00:00adminsetstatus: open -> drafting
2014-03-10 00:00:00admincreate