[libcxx-commits] [PATCH] D144775: [libc++][test] Add '-Wdeprecated-copy', '-Wdeprecated-copy-dtor' warnings to the test suite

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 26 06:29:28 PST 2023


fsb4000 added inline comments.


================
Comment at: libcxx/test/support/counting_predicates.h:24
+    unary_counting_predicate(const unary_counting_predicate&) = default;
+    unary_counting_predicate& operator=(const unary_counting_predicate&) = default;
     ~unary_counting_predicate() {}
----------------
fsb4000 wrote:
> fsb4000 wrote:
> > Mordante wrote:
> > > Are they used? Copying the `count_` seems wrong.
> > > 
> > > The same for copies of other stateful parts in the tests.
> > I saw the warnings but I will invistigate that.
> Yes, they called.
> ```
> C:/Dev/STL/llvm-project/libcxx/test/support\counting_predicates.h:25:5: error: definition of implicit copy constructor for 'unary_counting_predicate<bool (*)(int), int>' is deprecated because it has a user-provided destructor [-Werror,-Wdeprecated-copy-with-user-provided-dtor]
>     ~unary_counting_predicate() {}
>     ^
> C:\Dev\STL\llvm-project\libcxx\test\std\utilities\function.objects\refwrap\refwrap.helpers\ref_2.pass.cpp:60:22: note: in implicit copy constructor for 'unary_counting_predicate<bool (*)(int), int>' first required here
>     assert(call_pred(cp));
>                      ^
> ```
> 
> https://github.com/llvm/llvm-project/blob/bbaa79470423e63d075abef869ab4d5a203c51d3/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp#L25
> 
> https://github.com/llvm/llvm-project/blob/bbaa79470423e63d075abef869ab4d5a203c51d3/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp#L60
About `CDeleter`:
```
In file included from C:\Dev\STL\llvm-project\libcxx\test\std\utilities\smartptr\unique.ptr\unique.ptr.class\unique.ptr.asgn\move.pass.cpp:28:
C:/Dev/STL/llvm-project/libcxx/test/support/deleter_types.h:169:24: error: definition of implicit copy assignment operator for 'CDeleter<A>' is deprecated because it has a user-provided destructor [-Werror,-Wdeprecated-copy-with-user-provided-dtor]
  TEST_CONSTEXPR_CXX23 ~CDeleter() {
                       ^
C:/Dev/STL/llvm-project/build/include/c++/v1\__memory/unique_ptr.h:232:21: note: in implicit copy assignment operator for 'CDeleter<A>' first required here
    __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
                    ^
C:\Dev\STL\llvm-project\libcxx\test\std\utilities\smartptr\unique.ptr\unique.ptr.class\unique.ptr.asgn\move.pass.cpp:76:8: note: in instantiation of member function 'std::unique_ptr<A, CDeleter<A> &>::operator=' requested here
    s2 = std::move(s1);
       ^
C:\Dev\STL\llvm-project\libcxx\test\std\utilities\smartptr\unique.ptr\unique.ptr.class\unique.ptr.asgn\move.pass.cpp:133:5: note: in instantiation of function template specialization 'test_basic<false>' requested here
    test_basic</*IsArray*/ false>();
    ^
In file included from C:\Dev\STL\llvm-project\libcxx\test\std\utilities\smartptr\unique.ptr\unique.ptr.class\unique.ptr.asgn\move.pass.cpp:28:
C:/Dev/STL/llvm-project/libcxx/test/support/deleter_types.h:194:24: error: definition of implicit copy assignment operator for 'CDeleter<A[]>' is deprecated because it has a user-provided destructor [-Werror,-Wdeprecated-copy-with-user-provided-dtor]
  TEST_CONSTEXPR_CXX23 ~CDeleter() {
                       ^
C:/Dev/STL/llvm-project/build/include/c++/v1\__memory/unique_ptr.h:434:21: note: in implicit copy assignment operator for 'CDeleter<A[]>' first required here
    __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
                    ^
C:\Dev\STL\llvm-project\libcxx\test\std\utilities\smartptr\unique.ptr\unique.ptr.class\unique.ptr.asgn\move.pass.cpp:76:8: note: in instantiation of member function 'std::unique_ptr<A[], CDeleter<A[]> &>::operator=' requested here
    s2 = std::move(s1);
       ^
C:\Dev\STL\llvm-project\libcxx\test\std\utilities\smartptr\unique.ptr\unique.ptr.class\unique.ptr.asgn\move.pass.cpp:137:5: note: in instantiation of function template specialization 'test_basic<true>' requested here
    test_basic</*IsArray*/ true>();
    ^
2 errors generated.

error: command failed with exit status: 1
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144775/new/

https://reviews.llvm.org/D144775



More information about the libcxx-commits mailing list