When is a copy/move assignment operator implicitly defined?
_N4750_.15.8 [class.copy]
Mike Miller

Created on 2010-03-24.00:00:00 last changed 96 months ago


Date: 2010-11-15.00:00:00

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

Date: 2010-08-15.00:00:00

Proposed resolution (August, 2010):

This issue is resolved by the resolution of issue 1051.

Date: 2020-12-15.00:00:00
N3092 comment US 64

According to _N4750_.15.8 [class.copy] 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...”)

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: dr -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3189
2010-11-29 00:00:00adminsetstatus: tentatively ready -> dr
2010-10-18 00:00:00adminsetstatus: ready -> tentatively ready
2010-08-23 00:00:00adminsetmessages: + msg2797
2010-08-23 00:00:00adminsetstatus: open -> ready
2010-03-24 00:00:00admincreate