[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
Thu Apr 27 14:21:07 PDT 2023
mcgrathr updated this revision to Diff 517712.
mcgrathr marked an inline comment as done.
mcgrathr added a comment.
Added TODO comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149313/new/
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,11 +24,18 @@
_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)> {};
+// TODO: Remove this fallback when GCC < 13 support is no longer required.
+// GCC 13 has the __is_convertible built-in.
#else // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
namespace __is_convertible_imp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149313.517712.patch
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230427/7978208f/attachment.bin>
More information about the libcxx-commits
mailing list