Re: Using -stdlib=libc++ in g++13 requires adding __has_builtin(__is_convertible) handling to __type_traits/is_convertible.h

From: Mark Millard <marklmi_at_yahoo.com>
Date: Thu, 04 May 2023 22:15:04 UTC
On May 4, 2023, at 14:07, Mark Millard <marklmi@yahoo.com> wrote:
> 
> I have submitted https://github.com/llvm/llvm-project/issues/62556 for
> the issue:
> 
> QUOTE (whitespace details might not be preserved)
> On FreeBSD main [so: 14] (still LLVM 15.0.7 based) I updated from using the
> lang/gcc12 port to lang/gcc13 and my use of -stdlib=libc++ got lots of error
> reports from g++13. But it all turned out to be because __is_convertible is
> a builtin in g++13. The following addition to  __type_traits/is_convertible.h
> let me use g++13 -stdlib=libc++ (basically doing the same as already done for
> __is_convertible_to being a builtin):
> 
> # diff -u /usr/include/c++/v1/__type_traits/is_convertible.h.orig /usr/include/c++/v1/__type_traits/is_convertible.h
> --- /usr/include/c++/v1/__type_traits/is_convertible.h.orig 2023-05-04 13:37:14.535549000 -0700
> +++ /usr/include/c++/v1/__type_traits/is_convertible.h 2023-05-04 13:33:12.656731000 -0700
> @@ -29,6 +29,11 @@
>  template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
>      : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
> 
> +#elif __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)> {};
> +
>  #else  // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
> 
>  namespace __is_convertible_imp
> END QUOTE


Looks like this was fixed but will not be back ported to LLVM15:
"closed this as not planned" for LLVM15 but there is:

https://reviews.llvm.org/rG484e64f7e7b2c0494d7b2dbfdd528bcd707ee652


===
Mark Millard
marklmi at yahoo.com