[libcxx-commits] [PATCH] D149313: [libc++] Use __is_convertible built-in when available
Roland McGrath via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 26 17:31:02 PDT 2023
mcgrathr created this revision.
Herald added a project: All.
mcgrathr requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
https://github.com/llvm/llvm-project/issues/62396 reports that
GCC 13 barfs on parsing <type_traits> because of the declarations
of `struct __is_convertible`. In GCC 13, `__is_convertible` is a
built-in, but `__is_convertible_to` is not. Clang has both, so
using either should be fine.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149313
Files:
libcxx/include/__type_traits/is_convertible.h
Index: libcxx/include/__type_traits/is_convertible.h
===================================================================
--- libcxx/include/__type_traits/is_convertible.h
+++ libcxx/include/__type_traits/is_convertible.h
@@ -24,7 +24,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+#if __has_builtin(__is_convertible) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+
+template <class _T1, class _T2>
+struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
+
+#elif __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
: public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149313.517403.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230427/82489626/attachment.bin>
More information about the libcxx-commits
mailing list