summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-08-28 05:07:06 +0000
committerEric Fiselier <eric@efcs.ca>2015-08-28 05:07:06 +0000
commitd48306e7048c8f872ff92ce66c5704f5144cc352 (patch)
tree762779eb83c47f40427dd2835e7b874b86248027 /libcxx
parentcb38f75e29a56c45682d46753a45da0439ad86dd (diff)
downloadbcm5719-llvm-d48306e7048c8f872ff92ce66c5704f5144cc352.tar.gz
bcm5719-llvm-d48306e7048c8f872ff92ce66c5704f5144cc352.zip
[libcxx] Constrain unique_ptr::operator=(unique_ptr<Tp, Dp>) in C++03 mode
Summary: This patch properly constrains the converting assignment operator in C++03. It also fixes a bug where std::forward was given the wrong type. The following two tests begin passing in C++03: * `unique_ptr.single.asgn/move_convert.pass.cpp` * `unique_ptr.single.asgn/move_convert13.fail.cpp` Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12173 llvm-svn: 246272
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/memory11
1 files changed, 9 insertions, 2 deletions
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 9d214beb68f..4ed33084d95 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -2668,10 +2668,17 @@ public:
: __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;
}
OpenPOWER on IntegriCloud