This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 109a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2022-08-19


1426. Allowing additional parameter types in defaulted functions

Section: 9.5.2  [dcl.fct.def.default]     Status: CD5     Submitter: Nikolay Ivchenkov     Date: 2011-12-08

[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.

Rationale (February, 2012):

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