Hi mclow.lists, EricWF,

Partial fix for PR23256

https://llvm.org/bugs/show_bug.cgi?id=23256

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9085

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

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/tuple
===================================================================
--- include/tuple
+++ include/tuple
@@ -577,34 +577,40 @@
                     _VSTD::forward<_Up>(__u)...) {}
 
     template <class ..._Up,
-              typename enable_if
-                      <
-                         sizeof...(_Up) <= sizeof...(_Tp) &&
-                         __tuple_constructible
-                         <
-                            tuple<_Up...>,
-                            typename __make_tuple_types<tuple,
-                                     sizeof...(_Up) < sizeof...(_Tp) ?
-                                        sizeof...(_Up) :
-                                        sizeof...(_Tp)>::type
-                         >::value &&
-                         !__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),
+              typename enable_if<
+                 __lazy_and<
+                    __lazy_not<
+                       __lazy_and<
+                          integral_constant<bool, sizeof...(_Up)==1>,
+                          is_convertible<_Up..., tuple>
+                       >
+                    >,
+                    integral_constant<bool, sizeof...(_Up) <= sizeof...(_Tp)>,
+                    __tuple_constructible<
+                       tuple<_Up...>,
+                       typename __make_tuple_types<tuple,
                                 sizeof...(_Up) < sizeof...(_Tp) ?
-                                    sizeof...(_Up) :
-                                    sizeof...(_Tp)>::type
-                         >::value,
-                         bool
-                      >::type =false
-             >
+                                   sizeof...(_Up) :
+                                   sizeof...(_Tp)>::type
+                    >,
+                    __lazy_not<
+                       __tuple_convertible<
+                          tuple<_Up...>,
+                          typename __make_tuple_types<tuple,
+                                   sizeof...(_Up) < sizeof...(_Tp) ?
+                                      sizeof...(_Up) :
+                                      sizeof...(_Tp)>::type
+                       >
+                    >,
+                    __all_default_constructible<
+                       typename __make_tuple_types<tuple, sizeof...(_Tp),
+                           sizeof...(_Up) < sizeof...(_Tp) ?
+                               sizeof...(_Up) :
+                               sizeof...(_Tp)>::type
+                    >
+                 >::value,
+                 bool
+              >::type =false >
         _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
         explicit
         tuple(_Up&&... __u)
Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy_UTypes.pass.cpp
===================================================================
--- test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy_UTypes.pass.cpp
+++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy_UTypes.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class... UTypes>
+//   explicit tuple(UTypes&&... u);
+
+// PR23256: SFINAE on tuple(UTypes&&... u) erroneously calls UTypes(tuple<UTypes>) ctor.
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+
+struct A {
+  int value_;
+
+  template <typename T>
+  explicit constexpr A(T value)
+      : value_(static_cast<int>(value)) {}
+};
+
+static_assert(std::is_trivially_copy_constructible<std::tuple<A>>::value, "zz");
+
+int main() {}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to