[libcxx-commits] [PATCH] D74289: [libcxx] Fix unqualified call to 'ref' inside shared_ptr(unique_ptr<U, D>)

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 20 09:34:36 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG092a57f50821: [libc++] Fix unqualified call to 'ref' inside shared_ptr(unique_ptr<U, D>) (authored by logan-5, committed by ldionne).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74289

Files:
  libcxx/include/memory
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp


Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -49,6 +49,13 @@
 template <typename T>
 void assert_deleter ( T * ) { assert(false); }
 
+namespace adl {
+struct D {
+    void operator()(int *) const {}
+};
+void ref(D);
+}
+
 int main(int, char**)
 {
     {
@@ -98,5 +105,11 @@
     }
 #endif
 
+    {
+    adl::D d;
+    std::unique_ptr<int, adl::D&> u(nullptr, d);
+    std::shared_ptr<int> s = std::move(u);
+    }
+
   return 0;
 }
Index: libcxx/include/memory
===================================================================
--- libcxx/include/memory
+++ libcxx/include/memory
@@ -4174,7 +4174,7 @@
         typedef __shared_ptr_pointer<_Yp*,
                                      reference_wrapper<typename remove_reference<_Dp>::type>,
                                      _AllocT > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT());
+        __cntrl_ = new _CntrlBlk(__r.get(), _VSTD::ref(__r.get_deleter()), _AllocT());
         __enable_weak_this(__r.get(), __r.get());
     }
     __r.release();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74289.245678.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200220/4c8a948a/attachment.bin>


More information about the libcxx-commits mailing list