Merge commit 81b20e110b3f from llvm git (by Roland McGrath):

[libc++] Work around new GCC 15 type_traits builtins that can't be
    used as Clang's can (#137871)

    GCC 15 has added builtins for various C++ type traits that Clang
    already had.  Since `__has_builtin(...)` now finds these, the #if
    branches previously only used for Clang are now used for GCC 15.
    However, GCC 15 requires that these builtins only be used in type
    aliases, not in template aliases.

    For now, just don't use the `__has_builtin(...)` branches under newer
    GCC versions, so both 14 and 15 work during the transition.  This
    can be cleaned up later to use all the GCC 15 builtins available.

    Fixed: #137704
    Fixed: #117319

Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D54865
This commit is contained in:
John Baldwin
2026-01-27 13:34:58 -05:00
parent 093fffa296
commit bfc6e56f63
6 changed files with 6 additions and 6 deletions
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__add_lvalue_reference)
#if __has_builtin(__add_lvalue_reference) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __add_lvalue_reference_t = __add_lvalue_reference(_Tp);
@@ -20,7 +20,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer)
#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __add_pointer_t = __add_pointer(_Tp);
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__add_rvalue_reference)
#if __has_builtin(__add_rvalue_reference) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __add_rvalue_reference_t = __add_rvalue_reference(_Tp);
@@ -25,7 +25,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__decay)
#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_all_extents)
#if __has_builtin(__remove_all_extents) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
struct remove_all_extents {
using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp);
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_extent)
#if __has_builtin(__remove_extent) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
struct remove_extent {
using type _LIBCPP_NODEBUG = __remove_extent(_Tp);