[libcxx-commits] [libcxx] [libc++] Use remove_pointer builtin only for clang in traits impl (PR #91838)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 12 23:09:14 PDT 2024
================
@@ -17,7 +17,8 @@
_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)
----------------
Chilledheart wrote:
I disagress with that. Along with this, GCC has tons of new builtins in trunk targeting for 15.1 (or 14.2). They might be breaking things as well. There is no guarentee that other compilers other than clang will follow clang's way of handling builtins and will make changes finally. For example, below code doesn't changes since 2013.
```
#if __cplusplus > 201103L
/// Alias template for remove_pointer
template<typename _Tp>
using remove_pointer_t = typename remove_pointer<_Tp>::type;
/// Alias template for add_pointer
template<typename _Tp>
using add_pointer_t = typename add_pointer<_Tp>::type;
#endif
```
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/type_traits#L2146
For the same time, gcc 14.1 is available in archlinux and made as default compiler. That's what push me to make this change.
https://github.com/llvm/llvm-project/pull/91838
More information about the libcxx-commits
mailing list