[libcxx] Remove the "reduced-arity-initialization" extension from the uses-allocator constructors
Summary:
A default uses-allocator constructor has been added since that overload was previously provided by the extended constructor.
Since Clang does implicit conversion checking after substitution this constructor has to deduce the allocator_arg_t parameter so that it can prevent the evaluation of "is_default_constructible" if the first argument doesn't match. See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1391 for more information.
This patch fixes PR24779 (https://llvm.org/bugs/show_bug.cgi?id=24779)
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D19006
llvm-svn: 266409
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 90fb2baff7f48ac1525ff09c44874dd876d6cd63
diff --git a/include/tuple b/include/tuple
index cb1e27d..a39eeda 100644
--- a/include/tuple
+++ b/include/tuple
@@ -384,6 +384,9 @@
: is_same<__all<_Pred...>, __all<(_Pred, true)...>>
{ };
+template <class ..._Tp>
+struct __lazy_all : __all<_Tp::value...> {};
+
template <class _Tp>
struct __all_default_constructible;
@@ -523,6 +526,19 @@
_LIBCPP_CONSTEXPR tuple()
_NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+ template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = typename enable_if<
+ __lazy_and<
+ is_base_of<allocator_arg_t, _AllocArgT>,
+ __lazy_all<__dependent_type<is_default_constructible<_Tp>, _Dummy>...>
+ >::value
+ >::type>
+ _LIBCPP_INLINE_VISIBILITY
+ tuple(_AllocArgT, _Alloc const& __a)
+ : base_(allocator_arg_t(), __a,
+ __tuple_indices<>(), __tuple_types<>(),
+ typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
+ __tuple_types<_Tp...>()) {}
+
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
@@ -631,21 +647,8 @@
template <class _Alloc, class ..._Up,
class = typename enable_if
<
- sizeof...(_Up) <= sizeof...(_Tp) &&
- __tuple_convertible
- <
- tuple<_Up...>,
- typename __make_tuple_types<tuple,
- sizeof...(_Up) < sizeof...(_Tp) ?
- sizeof...(_Up) :
- sizeof...(_Tp)>::type
- >::value &&
- __all_default_constructible<
- typename __make_tuple_types<tuple, sizeof...(_Tp),
- sizeof...(_Up) < sizeof...(_Tp) ?
- sizeof...(_Up) :
- sizeof...(_Tp)>::type
- >::value
+ sizeof...(_Up) == sizeof...(_Tp) &&
+ __tuple_convertible<tuple<_Up...>, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY