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

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

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

  • (12.1) - class X has no virtual functions (10.3) and there is no virtual base classes (10.1) and
  • (12.2) - class X does not contain non-static data of an unstable type and
  • (12.3) - the constructor selected for copying / moving each direct base the subobject class is trivial, and
  • (12.4) - for each non-static data element X that has a class type (or array), the constructor selected for copying / moving this member is trivial;

otherwise, the copy / move constructor is not trivial.

I see that the above sentence was erased in N4606, but I could not find anything in C ++ Standard Core Language Active Issues, version 96 , to justify its removal from C ++ 14.

+6
source share
1 answer

This is the result of CWG 2171 . Deleted text only changes value in one case:

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

But regardless of whether this copy constructor is trivial, this is a separate question about whether it is actually invokable, so the source code was considered incompatible with the usual intent of the standard and, therefore, deleted.

+6
source

Source: https://habr.com/ru/post/1011477/


All Articles