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


2315. What is the “corresponding special member” of a variant member?

Section: 11.4.5.3  [class.copy.ctor]     Status: CD5     Submitter: Richard Smith     Date: 2016-08-15

[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:

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: