From 4dd24506040b357ff1fea80df73c3d12440eb0bf Mon Sep 17 00:00:00 2001 From: Andrei Tatar Date: Thu, 4 May 2023 16:20:31 +0200 Subject: [PATCH] patches: Backport upstream fix for __is_convertible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Stefan Jumarea Reviewed-by: Maria Sfiraiala Reviewed-by: Razvan Deaconescu Approved-by: Eduard Vintilă Tested-by: Unikraft CI GitHub-Closes: #28 --- ..._convertible-built-in-when-available.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/0001-Use-__is_convertible-built-in-when-available.patch diff --git a/patches/0001-Use-__is_convertible-built-in-when-available.patch b/patches/0001-Use-__is_convertible-built-in-when-available.patch new file mode 100644 index 0000000..faf471c --- /dev/null +++ b/patches/0001-Use-__is_convertible-built-in-when-available.patch @@ -0,0 +1,24 @@ +diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits +index 3391999675..ab126d000d 100644 +--- a/include/type_traits ++++ b/include/type_traits +@@ -1659,11 +1659,18 @@ struct __is_core_convertible<_Tp, _Up, decltype( + + // is_convertible + +-#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) ++#if __has_builtin(__is_convertible) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) ++ ++template ++struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant {}; ++ ++#elif __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) + + template struct _LIBCPP_TEMPLATE_VIS is_convertible + : public integral_constant {}; + ++// TODO: Remove this fallback when GCC < 13 support is no longer required. ++// GCC 13 has the __is_convertible built-in. + #else // __has_feature(is_convertible_to) + + namespace __is_convertible_imp -- 2.39.5