Date:2010-11-12
Author:Anthony Williams
Just Software Solutions Ltd
Revised by:Jason Merrill
Document NumberN3216=10-0206
Revision3

Removing Implicit Move Constructors and Move Assignment Operators

Proposed Wording Changes

These changes are against N3126.

12.8 Copying and moving class objects [class.copy]

Paragraphs 10/11:
If the class definition does not explicitly declare a move constructor, one will be implicitly declared as defaulted if and only if [ Note: When the move constructor is not implicitly declared or explicitly supplied, expressions that otherwise would have invoked the move constructor may instead invoke a copy constructor. — end note ]

A move constructor is never implicitly declared, but can be explicitly defaulted; for the purpose of comparison to such an explicit declaration (8.4.2), the notionalThe implicitly-declared move constructor for class X willis considered to have the form

  X::X(X&&)

Alter the first sentence of paragraph 12 as follows:

An implicitly-declared copy/move constructor is an inline public member of its class.

Delete paragraph 22.

If the class definition does not explicitly declare a move assignment operator ...

...

— end example ]

Paragraph 23:

A move assignment operator is never implicitly declared, but can be explicitly defaulted; for the purpose of comparison to such an explicit declaration (8.4.2), the notionalThe implicitly-declared move assignment operator for a class X willis considered to have the form
  X& X::operator=(X&&);

Alter the first two sentences of paragraph 24 as follows:

The implicitly-declaredA defaulted copy/move assignment operator for class X has the return type X&; it returns the object for which the assignment operator is invoked, that is, the object assigned to. An implicitly-declared copy/move assignment operator is an inline public member of its class. ...

Alter paragraph 26 as follows:

Because a copy/move assignment operator is implicitly declared for a class if not declared by the user, a base class copy/move assignment operator is always hidden by the corresponding assignment operator of a derived class (13.5.3). A using-declaration (7.3.3) that brings in from a base class an assignment operator with a parameter type that could be that of a copy/move assignment operator for the derived class is not considered an explicit declaration of such an operator and does not suppress the implicit declaration of the derived class operator; the operator introduced by the using-declaration is hidden by the implicitly-declared operator in the derived class.