Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What was the purpose of the emboldened text below in [class.copy]/12 in C++14?

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

like image 791
Alexander Avatar asked Oct 19 '16 12:10

Alexander


1 Answers

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.

like image 179
Barry Avatar answered Sep 20 '22 13:09

Barry