git: 2df58f190731 - main - Apply libc++ fix for compiling <type_traits> with gcc 13
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 May 2023 16:20:04 UTC
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=2df58f190731634be67e90b7c453dee587b4ea27 commit 2df58f190731634be67e90b7c453dee587b4ea27 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2023-05-05 16:19:40 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2023-05-05 16:19:40 +0000 Apply libc++ fix for compiling <type_traits> with gcc 13 Merge commit 484e64f7e7b2 from llvm-project (by Roland McGrath): [libc++] Use __is_convertible built-in when available https://github.com/llvm/llvm-project/issues/62396 reports that GCC 13 barfs on parsing <type_traits> because of the declarations of `struct __is_convertible`. In GCC 13, `__is_convertible` is a built-in, but `__is_convertible_to` is not. Clang has both, so using either should be fine. Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D149313 Reported by: Mark Millard <marklmi@yahoo.com> MFC after: 3 days --- .../llvm-project/libcxx/include/__type_traits/is_convertible.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h b/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h index 7e49cd4e6a31..7ce3c38b76de 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h @@ -24,11 +24,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) +#if __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)> {}; + +#elif __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {}; +// TODO: Remove this fallback when GCC < 13 support is no longer required. +// GCC 13 has the __is_convertible built-in. #else // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) namespace __is_convertible_imp