Created on 2011-08-16.00:00:00 last changed 121 months ago
[Moved to DR at the February, 2014 meeting.]
Proposed resolution (September, 2013):
Change 9.3.4.7 [dcl.fct.default] paragraph 6 as follows:
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 (11.4.5.3 [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:...
Delete the following from 11.4.5.3 [class.copy.ctor] paragraph 7:
...The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor.
Thus, for the class definitionstruct X { X(const X&, int); };
a copy constructor is implicitly-declared. If the user-declared constructor is later defined asX::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.
Notes from the September, 2013 meeting:
It was decided to resolve this issue separately from issue 1496, which is now decoupled from this issue.
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-11-24 00:00:00 | admin | set | status: dr -> c++14 |
2014-03-03 00:00:00 | admin | set | messages: + msg4958 |
2014-03-03 00:00:00 | admin | set | status: ready -> dr |
2013-10-14 00:00:00 | admin | set | messages: + msg4597 |
2013-10-14 00:00:00 | admin | set | messages: + msg4596 |
2013-10-14 00:00:00 | admin | set | status: drafting -> ready |
2011-08-16 00:00:00 | admin | create |