Skip to content

Commit 4dd2450

Browse files
andreittrunikraft-bot
authored andcommitted
patches: Backport upstream fix for __is_convertible
Replicate upstream commit 484e64f7e7b2c0494d7b2dbfdd528bcd707ee652. libcxx previously used the `__is_convertible_to` builtin which wasn't supported by GCC; this patch adds support for `__is_convertible` which is available as of GCC 13. Signed-off-by: Andrei Tatar <[email protected]> Reviewed-by: Stefan Jumarea <[email protected]> Reviewed-by: Maria Sfiraiala <[email protected]> Reviewed-by: Razvan Deaconescu <[email protected]> Approved-by: Eduard Vintilă <[email protected]> Tested-by: Unikraft CI <[email protected]> GitHub-Closes: unikraft#28
1 parent 39cdd0f commit 4dd2450

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
2+
index 3391999675..ab126d000d 100644
3+
--- a/include/type_traits
4+
+++ b/include/type_traits
5+
@@ -1659,11 +1659,18 @@ struct __is_core_convertible<_Tp, _Up, decltype(
6+
7+
// is_convertible
8+
9+
-#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
10+
+#if __has_builtin(__is_convertible) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
11+
+
12+
+template <class _T1, class _T2>
13+
+struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
14+
+
15+
+#elif __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
16+
17+
template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
18+
: public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
19+
20+
+// TODO: Remove this fallback when GCC < 13 support is no longer required.
21+
+// GCC 13 has the __is_convertible built-in.
22+
#else // __has_feature(is_convertible_to)
23+
24+
namespace __is_convertible_imp

0 commit comments

Comments
 (0)