This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Accepted as a DR at the November, 2017 meeting.]
According to 11.4.5.3 [class.copy.ctor] bullet 10.1,
A defaulted copy/move constructor for a class X is defined as deleted (9.5.3 [dcl.fct.def.delete]) if X has:
a variant member with a non-trivial corresponding constructor and X is a union-like class,
However, it is not clear from this specification how to handle an example like:
struct A { A(); A(const A&); }; union B { A a; };
since there is no corresponding special member in A.
Proposed resolution (August, 2017):
Change 11.4.5.3 [class.copy.ctor] paragraph 10 as follows:
An implicitly-declared copy/move constructor is an inline public member of its class. A defaulted copy/move constructor for a class X is defined as deleted (9.5.3 [dcl.fct.def.delete]) if X has:
a variant member with a non-trivial corresponding constructor and X is a union-like class,a potentially constructed subobject type M (or array thereof) that cannot be copied/moved because overload resolution (12.2 [over.match]), as applied to find M's corresponding constructor, results in an ambiguity or a function that is deleted or inaccessible from the defaulted constructor,
a variant member whose corresponding constructor as selected by overload resolution is non-trivial,
any potentially constructed subobject of a type with a destructor that is deleted or inaccessible from the defaulted constructor, or,
for the copy constructor, a non-static data member of rvalue reference type.