D4451: Fix copy/move issues casude by __tuple_leafs's converting constructor
llvm-svn: 213888
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 567bb79bf2f414bd93162383b368985580725b13
diff --git a/include/tuple b/include/tuple
index e98ae72..c3fdd40 100644
--- a/include/tuple
+++ b/include/tuple
@@ -210,7 +210,13 @@
"Attempted to default construct a reference element in a tuple");}
template <class _Tp,
- class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
+ class = typename enable_if<
+ __lazy_and<
+ __lazy_not<is_same<typename decay<_Tp>::type, __tuple_leaf>>
+ , is_constructible<_Hp, _Tp>
+ >::value
+ >::type
+ >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: value(_VSTD::forward<_Tp>(__t))
@@ -316,7 +322,13 @@
: _Hp(__a) {}
template <class _Tp,
- class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
+ class = typename enable_if<
+ __lazy_and<
+ __lazy_not<is_same<typename decay<_Tp>::type, __tuple_leaf>>
+ , is_constructible<_Hp, _Tp>
+ >::value
+ >::type
+ >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: _Hp(_VSTD::forward<_Tp>(__t)) {}
@@ -336,6 +348,9 @@
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: _Hp(_VSTD::forward<_Tp>(__t), __a) {}
+ __tuple_leaf(__tuple_leaf const &) = default;
+ __tuple_leaf(__tuple_leaf &&) = default;
+
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf&