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

2024-10-26


2690. Semantics of defaulted move assignment operator for unions

Section: 11.4.6  [class.copy.assign]     Status: C++23     Submitter: Cassio Neri     Date: 2023-01-20

[Accepted as a DR at the February, 2023 meeting.]

Subclause 11.4.6 [class.copy.assign] paragraph 13 does not specify the semantics of a defaulted move assignment operator:

The implicitly-defined copy assignment operator for a union X copies the object representation (6.8.1 [basic.types.general]) of X. ...

In contrast, the corresponding rule for move constructors is present in 11.4.5.3 [class.copy.ctor] paragraph 15:

The implicitly-defined copy/move constructor for a union X copies the object representation (6.8.1 [basic.types.general]) of X. ...

Proposed resolution (approved by CWG 2023-01-27):

Change in 11.4.6 [class.copy.assign] paragraph 13 as follows:

The implicitly-defined copy/move assignment operator for a union X copies the object representation (6.8.1 [basic.types.general]) of X. ...