From 732a7e5e2c725616332f1b06e35afd955a03d5b2 Mon Sep 17 00:00:00 2001 From: Florian Kargl Date: Sun, 26 Mar 2023 00:45:18 +0100 Subject: [PATCH] Use __is_convertible builtin in ustl when available Fix compilation on GCC 13 https://github.com/IAIK/sweb/issues/292 --- common/include/ustl/uttraits.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/include/ustl/uttraits.h b/common/include/ustl/uttraits.h index e0e251a9b..4cafccb3a 100644 --- a/common/include/ustl/uttraits.h +++ b/common/include/ustl/uttraits.h @@ -428,7 +428,16 @@ UNARY_TRAIT_DEFB (has_trivial_copy_assign, __has_trivial_assign(T)); template struct is_same : public false_type {}; template struct is_same : public true_type {}; -#if __clang__ // clang has __is_convertible builtin +#if defined __has_builtin + #if __has_builtin (__is_convertible) + #define USTL_BUILTIN__is_convertible 1 + #endif +#endif +#ifndef USTL_BUILTIN__is_convertible + #define USTL_BUILTIN__is_convertible 0 +#endif + +#if __clang__ || USTL_BUILTIN__is_convertible == 1 // clang, gcc >= 13 have __is_convertible builtin template struct is_convertible : public integral_constant {};