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 21:07:55 UTC
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


===
Mark Millard
marklmi at yahoo.com