[PATCH] D19006: [libcxx] Remove the "reduced-arity-initialization" extension from the uses-allocator constructors

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 21:41:11 PDT 2016


EricWF created this revision.
EricWF added a subscriber: cfe-commits.

http://reviews.llvm.org/D19006

Files:
  include/tuple
  test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp

Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
===================================================================
--- test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
+++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
@@ -30,7 +30,7 @@
 // are not explicitly initialized are not all default constructible.
 // Otherwise, std::is_constructible would return true but instantiating
 // the constructor would fail.
-void test_default_constructible_extension_sfinae()
+void test_default_constructible_sfinae()
 {
     {
         typedef std::tuple<MoveOnly, NoDefault> Tuple;
@@ -120,22 +120,7 @@
         assert(alloc_last::allocator_constructed);
         assert(std::get<2>(t) == alloc_last(3));
     }
-    // extensions
-    {
-        std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
-                                                   0, 1);
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == 1);
-        assert(std::get<2>(t) == MoveOnly());
-    }
-    {
-        std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(),
-                                                   0);
-        assert(std::get<0>(t) == 0);
-        assert(std::get<1>(t) == MoveOnly());
-        assert(std::get<2>(t) == MoveOnly());
-    }
     // Check that SFINAE is properly applied with the default reduced arity
     // constructor extensions.
-    test_default_constructible_extension_sfinae();
+    test_default_constructible_sfinae();
 }
Index: include/tuple
===================================================================
--- include/tuple
+++ include/tuple
@@ -523,6 +523,16 @@
     _LIBCPP_CONSTEXPR tuple()
         _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
 
+    template <class _Alloc, bool _Dummy = true, class = typename enable_if<
+        __all<__dependent_type<is_default_constructible<_Tp>, _Dummy>::value...>::value
+    >::type>
+    _LIBCPP_INLINE_VISIBILITY
+    tuple(allocator_arg_t, _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 +641,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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19006.53365.patch
Type: text/x-patch
Size: 3743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160412/074c365a/attachment-0001.bin>


More information about the cfe-commits mailing list