[libcxx-commits] [libcxx] [libc++] Don't use incomplete remove_pointer builtin for GCC (PR #91838)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 12 18:16:31 PDT 2024


https://github.com/Chilledheart updated https://github.com/llvm/llvm-project/pull/91838

>From 78fbde9e46d320e12a36ed51251e7d2e16f28d01 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++] Only use remove_pointer builtin for Clang

For reference, gcc's remove_pointer builtin is added in 14.1 release
but the implementation is incomplete.

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/commit/40dd7a5fe5d.
---
 libcxx/include/__type_traits/remove_pointer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h
index 54390a1939f7d..d41dbb577cc5e 100644
--- a/libcxx/include/__type_traits/remove_pointer.h
+++ b/libcxx/include/__type_traits/remove_pointer.h
@@ -17,7 +17,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
+#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) && defined(_LIBCPP_COMPILER_CLANG_BASED)
 template <class _Tp>
 struct remove_pointer {
   using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);



More information about the libcxx-commits mailing list