Fix several tuple bugs that were exposed by clang's implementation of CWG 1402. This fixes http://llvm.org/bugs/show_bug.cgi?id=17798.
llvm-svn: 194154
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 4478b25adec5eee7b9e2e434cb348feb393ff7de
diff --git a/include/tuple b/include/tuple
index 9f716fb..a1a7bcf 100644
--- a/include/tuple
+++ b/include/tuple
@@ -270,7 +270,7 @@
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_leaf(__tuple_leaf&& __t) _NOEXCEPT_(is_nothrow_move_constructible<_Hp>::value)
- : value(_VSTD::move(__t.get()))
+ : value(_VSTD::forward<_Hp>(__t.get()))
{}
template <class _Tp>
@@ -457,13 +457,24 @@
return *this;
}
- _LIBCPP_INLINE_VISIBILITY
- __tuple_impl&
- operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
- {
- __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
- return *this;
- }
+ __tuple_impl(const __tuple_impl&) = default;
+ __tuple_impl(__tuple_impl&&) = default;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __tuple_impl&
+ operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
+ {
+ __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
+ return *this;
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ __tuple_impl&
+ operator=(__tuple_impl&& __t) _NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value))
+ {
+ __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...);
+ return *this;
+ }
_LIBCPP_INLINE_VISIBILITY
void swap(__tuple_impl& __t)