Adding new special member functions to a class via default arguments
Section [class.copy.ctor]
Sean Hunt

Created on 2011-08-16.00:00:00 last changed 92 months ago


Date: 2014-02-15.00:00:00

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

Date: 2013-09-15.00:00:00

Proposed resolution (September, 2013):

  1. Change [dcl.fct.default] paragraph 6 as follows:

  2. Except for member functions of class templates, the default arguments in a member function definition that appears outside of the class definition are added to the set of default arguments provided by the member function declaration in the class definition; the program is ill-formed if a default constructor (11.4.5 [class.ctor]), copy or move constructor, or copy or move assignment operator ( [class.copy.ctor]) is so declared. Default arguments for a member function of a class template shall be specified on the initial declaration of the member function within the class template. [Example:...
  3. Delete the following from [class.copy.ctor] paragraph 7:

  4. ...The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. Thus, for the class definition

      struct X {
        X(const X&, int);

    a copy constructor is implicitly-declared. If the user-declared constructor is later defined as

      X::X(const X& x, int i =0) { /* ... */ }

    then any use of X's copy constructor is ill-formed because of the ambiguity; no diagnostic is required.

Date: 2013-09-15.00:00:00

Notes from the September, 2013 meeting:

It was decided to resolve this issue separately from issue 1496, which is now decoupled from this issue.

Date: 2013-10-14.00:00:00
N3690 comment CA 29

If default arguments added in the out-of-class definition of a constructor make it a special member function, this can affect the overload resolution and thus the implicit exception specification and the triviality of an implicitly-declared special member function in a derived class.

See also issue 1496, which should also be addressed by the resolution of this issue.

Date User Action Args
2014-11-24 00:00:00adminsetstatus: dr -> c++14
2014-03-03 00:00:00adminsetmessages: + msg4958
2014-03-03 00:00:00adminsetstatus: ready -> dr
2013-10-14 00:00:00adminsetmessages: + msg4597
2013-10-14 00:00:00adminsetmessages: + msg4596
2013-10-14 00:00:00adminsetstatus: drafting -> ready
2011-08-16 00:00:00admincreate