Created on 2005-10-07.00:00:00 last changed 90 months ago
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
Proposed Resolution (August, 2011):
Change 6.3 [basic.def.odr] paragraph 2 as follows:
...[Note: This covers calls to named functions (188.8.131.52 [expr.call]), operator overloading (Clause Clause 12 [over]), user-defined conversions (184.108.40.206 [class.conv.fct]), allocation function for placement new (220.127.116.11 [expr.new]), as well as non-default initialization (9.4 [dcl.init]). A
copy constructor or moveconstructor is odr-used even if the call is actually elided by the implementation . —end note] ... A copy-assignment function for a classis odr-used by an implicitly-defined copy-assignment function for another class as specified in _N4750_.15.8 [class.copy]. A move-assignment function for a class is odr-used by an implicitly-defined move-assignment function for another class as specified in _N4750_.15.8 [class.copy].A default constructor...
Delete 11.4.5 [class.ctor] paragraph 9:
A copy constructor (_N4750_.15.8 [class.copy]) is used to copy objects of class type. A move constructor (_N4750_.15.8 [class.copy]) is used to move the contents of objects of class type.
Change 6.7.7 [class.temporary] paragraph 1 as follows:
even if there is no call to the destructor or copy/move constructor, all the semantic restrictions, such as accessibility (Clause 11.8 [class.access]) and whether the function is deleted (9.5.3 [dcl.fct.def.delete]), shall be satisfied.However, in the special case of a function call...
Change _N4750_.15.8 [class.copy] paragraph 13 as follows:
A copy/move constructor that is defaulted and not defined as deleted is implicitly defined if it is odr-used (6.3 [basic.def.odr])
to initialize an object of its class type from a copy of an object of its class type or of a class type derived from its class type [Footnote: See 9.4 [dcl.init] for more details on direct and copy initialization. —end footnote]or when it is explicitly defaulted...
When certain criteria are met, an implementation is allowed to omit the copy/move construction of a class object, even if the
copy/moveconstructor and/or destructor for the object have side effects...
Change 18.104.22.168.3 [over.ics.user] paragraph 4 as follows:
A conversion of an expression of class type to the same class type is given Exact Match rank, and a conversion of an expression of class type to a base class of that type is given Conversion rank, in spite of the fact that a
copy/moveconstructor (i.e., a user-defined conversion function) is called for those cases.
Change 14.2 [except.throw] paragraph 3 as follows:
A throw-expression initializes a temporary object, called the exception object...
Change 14.2 [except.throw] paragraph 5 as follows:
When the thrown object is a class object, the
copy/moveconstructor and the destructor shall be accessible, even if the copy/move operation is elided (_N4750_.15.8 [class.copy]).
[Drafting note: 7.6.19 [expr.ass] paragraph 4, Clause 11 [class] paragraph 4, 11.5 [class.union] paragraph 1, 6.7.7 [class.temporary] paragraph 2, _N4750_.15.8 [class.copy] paragraphs 1-2, and 14.5 [except.spec] paragraph 14 do not require any changes.]
Footnote 112 (_N4750_.15.8 [class.copy] paragraph 2) says,
Because a template constructor is never a copy constructor, the presence of such a template does not suppress the implicit declaration of a copy constructor. Template constructors participate in overload resolution with other constructors, including copy constructors, and a template constructor may be used to copy an object if it provides a better match than other constructors.
However, many of the stipulations about copy construction are phrased to refer only to “copy constructors.” For example, _N4750_.15.8 [class.copy] paragraph 14 says,
A program is ill-formed if the copy constructor... for an object is implicitly used and the special member function is not accessible (clause 11.8 [class.access]).
Does that mean that using an inaccessible template constructor to copy an object is permissible, because it is not a “copy constructor?” Obviously not, but each use of the term “copy constructor” in the Standard should be examined to determine if it applies strictly to copy constructors or to any constructor used for copying. (A similar issue applies to “copy assignment operators,” which have the same relationship to assignment operator function templates.)
|2014-03-03 00:00:00||admin||set||status: drwp -> cd3|
|2012-11-03 00:00:00||admin||set||status: dr -> drwp|
|2012-02-27 00:00:00||admin||set||status: ready -> dr|
|2011-09-06 00:00:00||admin||set||status: review -> ready|
|2008-03-17 00:00:00||admin||set||messages: + msg1594|
|2008-02-03 00:00:00||admin||set||messages: + msg1566|
|2008-02-03 00:00:00||admin||set||status: open -> review|