EricWF updated this revision to Diff 69591.
EricWF added a comment.

Add testcase to patch.


https://reviews.llvm.org/D23999

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

Index: 
test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR29123_implicit_constructor_sfinae.pass.cpp
===================================================================
--- /dev/null
+++ 
test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR29123_implicit_constructor_sfinae.pass.cpp
@@ -0,0 +1,21 @@
+// repro.cpp
+// this is minimized code from folly library
+#include<tuple>
+
+template<class Value>
+struct Optional {
+  Optional() = default;
+  // implicit
+  Optional(const Value&) {}
+};
+
+struct dynamic {
+  // implicit
+  template<class T> dynamic(T) {}
+};
+
+Optional<std::tuple<dynamic>> get() { return {}; }
+
+int main() {
+  auto x = get();
+}
Index: include/tuple
===================================================================
--- include/tuple
+++ include/tuple
@@ -537,6 +537,9 @@
                                  sizeof...(_Tp)>::type
                 >::value;
         }
+      template <class ..._Args>
+      struct __enable_implicit_t :  integral_constant<bool, 
__enable_implicit<_Args...>()> {};
+
     };
 
     template <bool _MaybeEnable,
@@ -708,7 +711,7 @@
                          _CheckArgsConstructor<
                              sizeof...(_Up) <= sizeof...(_Tp)
                              && !_PackExpandsToThisTuple<_Up...>::value
-                         >::template __enable_implicit<_Up...>(),
+                         >::template __enable_implicit_t<_Up...>::value,
                          bool
                       >::type = false
              >
Index: include/__tuple
===================================================================
--- include/__tuple
+++ include/__tuple
@@ -475,6 +475,8 @@
     template <class ...>
     static constexpr bool __enable_implicit() { return false; }
     template <class ...>
+    using __enable_implicit_t = false_type;
+    template <class ...>
     static constexpr bool __enable_assign() { return false; }
 };
 #endif


Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR29123_implicit_constructor_sfinae.pass.cpp
===================================================================
--- /dev/null
+++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR29123_implicit_constructor_sfinae.pass.cpp
@@ -0,0 +1,21 @@
+// repro.cpp
+// this is minimized code from folly library
+#include<tuple>
+
+template<class Value>
+struct Optional {
+  Optional() = default;
+  // implicit
+  Optional(const Value&) {}
+};
+
+struct dynamic {
+  // implicit
+  template<class T> dynamic(T) {}
+};
+
+Optional<std::tuple<dynamic>> get() { return {}; }
+
+int main() {
+  auto x = get();
+}
Index: include/tuple
===================================================================
--- include/tuple
+++ include/tuple
@@ -537,6 +537,9 @@
                                  sizeof...(_Tp)>::type
                 >::value;
         }
+      template <class ..._Args>
+      struct __enable_implicit_t :  integral_constant<bool, __enable_implicit<_Args...>()> {};
+
     };
 
     template <bool _MaybeEnable,
@@ -708,7 +711,7 @@
                          _CheckArgsConstructor<
                              sizeof...(_Up) <= sizeof...(_Tp)
                              && !_PackExpandsToThisTuple<_Up...>::value
-                         >::template __enable_implicit<_Up...>(),
+                         >::template __enable_implicit_t<_Up...>::value,
                          bool
                       >::type = false
              >
Index: include/__tuple
===================================================================
--- include/__tuple
+++ include/__tuple
@@ -475,6 +475,8 @@
     template <class ...>
     static constexpr bool __enable_implicit() { return false; }
     template <class ...>
+    using __enable_implicit_t = false_type;
+    template <class ...>
     static constexpr bool __enable_assign() { return false; }
 };
 #endif
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to