[libcxx-commits] [PATCH] D112048: [libc++] [test] Add tests for converting array types in shared_ptr.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 18 18:43:40 PDT 2021


var-const created this revision.
var-const added a reviewer: ldionne.
var-const requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

The only possible kind of a conversion in initialization of a shared
pointer to an array is a qualification conversion (i.e., adding
cv-qualifiers). This patch adds tests for converting from `A[]` to
`const A[]` to the following functions:

  template<class Y> explicit shared_ptr(Y* p);
  
  template<class Y> shared_ptr(const shared_ptr<Y>& r);
  template<class Y> shared_ptr(shared_ptr<Y>&& r);
  
  template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r);
  template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r);
  
  template<class Y> void reset(Y* p);
  template<class Y, class D> void reset(Y* p, D d);
  template<class Y, class D, class A> void reset(Y* p, D d, A a);

Similar tests for converting functions that involve a `weak_ptr` should
be added once LWG issue 3001 <https://cplusplus.github.io/LWG/issue3001>
is implemented.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112048

Files:
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112048.380566.patch
Type: text/x-patch
Size: 8050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211019/9f952f9b/attachment.bin>


More information about the libcxx-commits mailing list