[PATCH] D41048: [libcxx] workaround PR 28385 in __find_exactly_one_checked
Casey Carter via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 9 09:18:04 PST 2017
CaseyCarter created this revision.
Fixes #35578.
https://reviews.llvm.org/D41048
Files:
include/tuple
Index: include/tuple
===================================================================
--- include/tuple
+++ include/tuple
@@ -1012,10 +1012,21 @@
template <class _T1, class ..._Args>
struct __find_exactly_one_checked {
- static constexpr bool __matches[] = {is_same<_T1, _Args>::value...};
+#if defined(__clang__) && __clang_major__ > 5 && __cplusplus > 201402L
+ // Workaround https://bugs.llvm.org/show_bug.cgi?id=28385
+ inline _LIBCPP_INLINE_VISIBILITY
+ static constexpr size_t __index()
+ {
+ constexpr bool __matches[] = {is_same<_T1, _Args>::value...};
+ return __find_detail::__find_idx(0, __matches);
+ }
+ static constexpr size_t value = __index();
+#else
+ static constexpr bool __matches[] = {is_same<_T1, _Args>::value...};
static constexpr size_t value = __find_detail::__find_idx(0, __matches);
- static_assert (value != __not_found, "type not found in type list" );
- static_assert(value != __ambiguous,"type occurs more than once in type list");
+#endif
+ static_assert(value != __not_found, "type not found in type list" );
+ static_assert(value != __ambiguous, "type occurs more than once in type list");
};
template <class _T1>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41048.126276.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171209/ad77a0da/attachment.bin>
More information about the cfe-commits
mailing list