diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-11-06 17:45:43 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-11-06 17:45:43 +0000 |
commit | 3de5086dc785ff7c1c4f0f09ff26808289b75aca (patch) | |
tree | a711e22cc19ca5b85baf686dfaa29f0bfa200466 /include/tuple | |
parent | ecc8d7b334f25a4e9c6aae7c3260cf27bdaab976 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/tuple')
-rw-r--r-- | include/tuple | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/tuple b/include/tuple index 9f716fb20..a1a7bcf0b 100644 --- a/include/tuple +++ b/include/tuple @@ -270,7 +270,7 @@ public: _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 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> 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) |