This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1731. is_trivially_X and definitions of special member functions

Section:  [class.copy.ctor]     Status: NAD     Submitter: James Widman     Date: 2013-08-07

Consider an example like,

  struct A {
    A() = default;
    A(A&) = default;
    A(const A&) = default;

  struct B {
    A a;
    B() = default;
    B(const B&) = default;

  struct C {
    mutable A a;
    C() = default;
    C(const C&) = default;

Presumably, all static_assert() conditions above are desired to evaluate true. Implementations diverge on this.

To decide whether a class is trivially copyable (Clause 11 [class] paragraph 6) , we need to see whether it has a non-trivial copy constructor. So eventually we hit [class.copy.ctor] paragraph 12:

A copy/move constructor for class X is trivial if it is not user-provided, its declared parameter type is the same as if it had been implicitly declared, and if

otherwise the copy/move constructor is non-trivial.

which seem to imply that the copy constructor needs to have been implicitly defined before we consider this rule. But copy ctors are not odr-used in this example, so they're not implicitly-defined (paragraph 13).

The same considerations apply to copy/move assignment operators.

It might be sufficient to clarify this specification by replacing “selected to” with “that would be selected to.”

Rationale (September, 2013):

CWG felt that the existing wording was clear enough.