Allowing additional parameter types in defaulted functions
9.5.2 [dcl.fct.def.default]
Nikolay Ivchenkov

Created on 2011-12-08.00:00:00 last changed 5 months ago


Date: 2012-02-15.00:00:00

Rationale (February, 2012):

This is a request to extend the language and is thus more appropriately considered by EWG.

Date: 2017-11-15.00:00:00

[Adopted at the November, 2017 meeting as part of paper P0641R2.]

The current wording of 9.5.2 [dcl.fct.def.default] paragraph 1 allows copy constructors and copy assignment operators to have a reference to non-const parameter, even if the implicitly-declared function would have had a reference to const parameter. This is safe because the sub-object copy functions that take a reference to const parameter can be invoked with a non-const lvalue.

It would also be possible to allow the inverse situation — permitting the defaulted function to be defined with a reference to const parameter, even though the sub-object functions have a reference to non-const parameter — by defining the defaulted function as deleted.

See also issue 1331.

Date User Action Args
2021-02-17 00:00:00adminsetstatus: extension -> cd5
2012-02-27 00:00:00adminsetmessages: + msg3864
2012-02-27 00:00:00adminsetstatus: open -> extension
2011-12-08 00:00:00admincreate