[PATCH] D41048: [libcxx] workaround PR 28385 in __find_exactly_one_checked
Casey Carter via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 10 11:25:03 PST 2017
CaseyCarter updated this revision to Diff 126297.
CaseyCarter added a comment.
Hide the ugly version test in `<__config>`, define a slightly-more-meaningful macro `_LIBCPP_WORKAROUND_CLANG_28385`.
https://reviews.llvm.org/D41048
Files:
include/__config
include/tuple
Index: include/tuple
===================================================================
--- include/tuple
+++ include/tuple
@@ -1012,10 +1012,20 @@
template <class _T1, class ..._Args>
struct __find_exactly_one_checked {
- static constexpr bool __matches[] = {is_same<_T1, _Args>::value...};
+#if defined(_LIBCPP_WORKAROUND_CLANG_28385) && _LIBCPP_WORKAROUND_CLANG_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 // _LIBCPP_WORKAROUND_CLANG_28385
+ 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 // _LIBCPP_WORKAROUND_CLANG_28385
+ 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>
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -456,7 +456,7 @@
// Allow for build-time disabling of unsigned integer sanitization
#if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
-#endif
+#endif
#if __has_builtin(__builtin_launder)
#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
@@ -1273,6 +1273,14 @@
# endif
#endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
+#ifndef _LIBCPP_WORKAROUND_CLANG_28385
+ #if defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 600 && _LIBCPP_STD_VER > 14
+ #define _LIBCPP_WORKAROUND_CLANG_28385 1
+ #else
+ #define _LIBCPP_WORKAROUND_CLANG_28385 0
+ #endif
+#endif
+
#endif // __cplusplus
#endif // _LIBCPP_CONFIG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41048.126297.patch
Type: text/x-patch
Size: 2168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171210/68d2fa7e/attachment.bin>
More information about the cfe-commits
mailing list