<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60977>60977</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Deprecated implicit copy ctors/assigns in `libcxx/test`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          StephanTLavavej
      </td>
    </tr>
</table>

<pre>
    MSVC is implementing a new warning (off-by-default) to detect the following deprecated cases (I've heard that Clang and GCC `-Wdeprecated` can also detect this) in [N4928](https://wg21.link/N4928) [\[class.copy.ctor\]/6](https://eel.is/c++draft/class.copy.ctor#6) (emphasis mine):

> If the class definition does not explicitly declare a copy constructor, a non-explicit one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defaulted (9.5). **The latter case is deprecated** if the class has a user-declared copy assignment operator or a user-declared destructor (D.8).

and [\[class.copy.assign\]/2](https://eel.is/c++draft/class.copy.assign#2) (emphasis mine):

> If the class definition does not explicitly declare a copy assignment operator, one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy assignment operator is defined as deleted; otherwise, it is defaulted (9.5). **The latter case is deprecated** if the class has a user-declared copy constructor or a user-declared destructor (D.8).

While cleaning up MSVC's STL (see https://github.com/microsoft/STL/pull/3497), I found the following deprecated implicit copy ctors/assigns in libcxx's test suite:

* `llvm-project/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp`(29):
 + warning C5267: definition of implicit copy constructor for `'A'` is deprecated because it has a user-provided destructor
  + https://github.com/llvm/llvm-project/blob/53689fdfb29767a12b4d5ad41c67a705a3c622de/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp#L24-L33
* `llvm-project/libcxx/test/support/deleter_types.h`(191):
  + warning C5267: definition of implicit copy constructor for `'CDeleter<A []>'` is deprecated because it has a user-provided destructor
  + https://github.com/llvm/llvm-project/blob/53689fdfb29767a12b4d5ad41c67a705a3c622de/libcxx/test/support/deleter_types.h#L181-L200
* `llvm-project/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp`(29):
 + warning C5267: definition of implicit assignment operator for `'B'` is deprecated because it has a user-provided destructor
  + warning C5267: definition of implicit copy constructor for `'B'` is deprecated because it has a user-provided destructor
  + https://github.com/llvm/llvm-project/blob/53689fdfb29767a12b4d5ad41c67a705a3c622de/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp#L26-L30

@CaseyCarter's https://reviews.llvm.org/D144694 fixes other occurrences in `any` and `optional`'s tests.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUV01v4zYQ_TX0hbAgD_VhHXzwx6pYwO0lQfe4oMRRxC0tCiTlxP--GMlJbCMpkCLobi-xyAznzcx7nJGk9_qhQ1yxdMPS3UwOobVudRewb2V3v5dHecQfs8qq0-r3uz-3XHuuD73BA3ZBdw9c8g4f-aN0Ha0YLG3TzKvTXGEjBxMYFDxYrjBgHXhokTfWGPtIxgp7h7UMqHgtPXo6_ZVBfkTeonSKh1YGvjWSYDrFf9tuOcvi-bfXgyyLeS07Lo2_ANGeYHXHWbr5IylgydIdg2UbQu-ZWDMoGZSPD7CIjO7-YlBORlDwsQpblm5qI72PatufojpYN27uGJTZW64QTUSYZc1gw2CjnGwCLW-cgMhGEFjioW-l154fdIcMCnIV71j8_Fd84V-bsVyjD66w0Z0O2nZcWfS8s4HjU290rYM5cYW1kQ655ATGa9v54IYJc0sU2W7-bM5th8Ti-Ywa6Zz8RO-DTsaeS36wR7xE4NZNe5OUSBfc9ujkGZ38vUK8wt5GOsXU6A4Vl_RokAgWG25Di-5ReyR3OpwNSV2oqJhFlDIoIs5gzWB93yI3MgR0o6om6xe9jCZcX6bZSkpr8Ojm18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