[PATCH] D23999: [libc++] Minimal std::tuple fix for PR29123
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 11:18:10 PDT 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23999.69591.patch
Type: text/x-patch
Size: 1918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160829/61ff2fd7/attachment-0001.bin>
More information about the cfe-commits
mailing list