[PATCH] D12173: [libcxx] Constrain unique_ptr::operator=(unique_ptr<Tp, Dp>) in C++03 mode

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 15:51:12 PDT 2015


EricWF updated this revision to Diff 32631.
EricWF added a comment.

Update diff so it has more context.


http://reviews.llvm.org/D12173

Files:
  include/memory

Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -2659,10 +2659,17 @@
         : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
 
     template <class _Up, class _Ep>
-    _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep> __u)
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<
+        !is_array<_Up>::value &&
+        is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
+        is_assignable<deleter_type&, _Ep&>::value,
+        unique_ptr&
+    >::type
+    operator=(unique_ptr<_Up, _Ep> __u)
     {
         reset(__u.release());
-        __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+        __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
         return *this;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12173.32631.patch
Type: text/x-patch
Size: 870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150819/0678dbfd/attachment.bin>


More information about the cfe-commits mailing list