[libcxx-commits] [libcxx] [libc++] Use remove_pointer builtin as library traits (PR #91838)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 14 23:12:37 PDT 2024
https://github.com/Chilledheart updated https://github.com/llvm/llvm-project/pull/91838
>From e3acb2796aaf634532f7a351f30ff0a87b8c9f52 Mon Sep 17 00:00:00 2001
From: Keeyou <keeyou-cn at outlook.com>
Date: Sat, 11 May 2024 12:10:03 +0800
Subject: [PATCH] [libc++] Use remove_pointer builtin as library traits.
In new GCC release (such as 14.1), a new warning is added that
all traits are not to be used directly but library traits.
Keep the same structure with gcc's library traits to prevent future
issues.
see https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/type_traits#L2105
and https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/type_traits#L2146.
Fixes #91831.
---
libcxx/include/__type_traits/remove_pointer.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h
index 54390a1939f7d..eea523ab2dceb 100644
--- a/libcxx/include/__type_traits/remove_pointer.h
+++ b/libcxx/include/__type_traits/remove_pointer.h
@@ -22,9 +22,6 @@ template <class _Tp>
struct remove_pointer {
using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);
};
-
-template <class _Tp>
-using __remove_pointer_t = __remove_pointer(_Tp);
#else
// clang-format off
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;};
@@ -33,10 +30,10 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const>
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;};
// clang-format on
+#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
template <class _Tp>
using __remove_pointer_t = typename remove_pointer<_Tp>::type;
-#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
#if _LIBCPP_STD_VER >= 14
template <class _Tp>
More information about the libcxx-commits
mailing list