6
votes

[class.copy]/12 in C++14:

A copy/move constructor for class X is trivial if it is not user-provided, its parameter-type-list is equivalent to the parameter-type-list of an implicit declaration, and if

  • (12.1) — class X has no virtual functions (10.3) and no virtual base classes (10.1), and
  • (12.2) — class X has no non-static data members of volatile-qualified type, and
  • (12.3) — the constructor selected to copy/move each direct base class subobject is trivial, and
  • (12.4) — for each non-static data member of X that is of class type (or array thereof), the constructor selected to copy/move that member is trivial;

otherwise the copy/move constructor is non-trivial.

I can see that the sentence above was erased in N4606, but I couldn't find anything in C++ Standard Core Language Active Issues, Revision 96 to justify its removal from C++14.

1
I wonder if it was added because the implicit copy constructor could have the form X::X(const X&) or X::X(X&)NathanOliver
Maybe I'm missing it, but if it is not user-provided, how could its parameter list differ from the implicit one ? I think that "not user-provided" was meant to replace it, but it slipped by.Quentin

1 Answers

6
votes

This is a result of CWG 2171. The removed text only changes the meaning in one case:

struct X {
    X(X& ) = default; // not user-provided
                      // parameter-type-list differs from implicit declaration's X const&
                      // wasn't trivial before, is trivial now
};

But whether or not this copy constructor is trivial is a separate question of whether or not it is actually invokable, so the original text was deemed inconsistent with the usual intent of the standard and hence removed.