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

2024-04-18


1066. When is a copy/move assignment operator implicitly defined?

Section: 11.4.6  [class.copy.assign]     Status: C++11     Submitter: Mike Miller     Date: 2010-03-24

[Voted into the WP at the November, 2010 meeting.]

N3092 comment US 64

According to 11.4.5.3 [class.copy.ctor] paragraph 28,

A copy/move assignment operator that is defaulted and not defined as deleted is implicitly defined when an object of its class type is assigned a value of its class type or a value of a class type derived from its class type or when it is explicitly defaulted after its first declaration.

This sounds as if any assignment to a class object, regardless of whether it is a copy or a move assignment, defines both the copy and move operators. Presumably an assignment should only define the assignment operator chosen by overload resolution for the operation. (Compare the corresponding wording in paragraph 14 for the copy/move constructors: “...implicitly defined if it is used to initialize an object of its class type...”)

Proposed resolution (August, 2010):

This issue is resolved by the resolution of issue 1051.