diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-07-25 01:45:07 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-07-25 01:45:07 +0000 |
| commit | 189f88ca35cd038da52bfdb338e37a0c15fa69bb (patch) | |
| tree | db048945da4dc4f8aaf59c573866aaa44f505506 /libcxx/include/utility | |
| parent | d6ddc7e0a8a34600eefdbce0ac36da5ef22f1642 (diff) | |
| download | bcm5719-llvm-189f88ca35cd038da52bfdb338e37a0c15fa69bb.tar.gz bcm5719-llvm-189f88ca35cd038da52bfdb338e37a0c15fa69bb.zip | |
Revert r276548 - Make pair/tuples assignment operators SFINAE properly.
This is a breaking change. The SFINAE required is instantiated the second
the class is instantiated, and this can cause hard SFINAE errors
when applied to references to incomplete types. Ex.
struct IncompleteType;
extern IncompleteType it;
std::tuple<IncompleteType&> t(it); // SFINAE will blow up.
llvm-svn: 276598
Diffstat (limited to 'libcxx/include/utility')
| -rw-r--r-- | libcxx/include/utility | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/libcxx/include/utility b/libcxx/include/utility index 9a155a00fb4..022a641d6e8 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -348,19 +348,8 @@ struct _LIBCPP_TYPE_VIS_ONLY pair // Use the implicitly declared copy constructor in C++03 #endif - typedef typename remove_reference<_T1>::type _T1Unref; - typedef typename remove_reference<_T2>::type _T2Unref; - -#if !defined(_LIBCPP_CXX03_LANG) - typedef integral_constant<bool, - is_copy_assignable<_T1>::value - && is_copy_assignable<_T2>::value> _CanCopyAssign; -#else - typedef true_type _CanCopyAssign; -#endif - _LIBCPP_INLINE_VISIBILITY - pair& operator=(typename conditional<_CanCopyAssign::value, pair, __nat>::type const& __p) + pair& operator=(const pair& __p) _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value && is_nothrow_copy_assignable<second_type>::value) { @@ -388,15 +377,10 @@ struct _LIBCPP_TYPE_VIS_ONLY pair : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} - typedef integral_constant<bool, - is_move_assignable<_T1>::value - && is_move_assignable<_T2>::value> _CanMoveAssign; - _LIBCPP_INLINE_VISIBILITY pair& - operator=(typename conditional<_CanMoveAssign::value, pair, __nat>::type&& __p) - _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value && - is_nothrow_move_assignable<second_type>::value) + operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value && + is_nothrow_move_assignable<second_type>::value) { first = _VSTD::forward<first_type>(__p.first); second = _VSTD::forward<second_type>(__p.second); @@ -404,6 +388,7 @@ struct _LIBCPP_TYPE_VIS_ONLY pair } #ifndef _LIBCPP_HAS_NO_VARIADICS + template<class _Tuple, class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -426,7 +411,7 @@ struct _LIBCPP_TYPE_VIS_ONLY pair {} template <class _Tuple, - class = typename enable_if<!is_same<typename decay<_Tuple>::type, pair>::value && __tuple_assignable<_Tuple, pair>::value>::type> + class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type> _LIBCPP_INLINE_VISIBILITY pair& operator=(_Tuple&& __p) |

