New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
latest libc++ doesn't compile with gcc 14.1 #91831
Comments
For comparison, below is libstdc++'s implementation (from https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/type_traits#L2105): /// remove_pointer
#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer)
template<typename _Tp>
struct remove_pointer
{ using type = __remove_pointer(_Tp); };
#else
template<typename _Tp, typename>
struct __remove_pointer_helper
{ using type = _Tp; };
template<typename _Tp, typename _Up>
struct __remove_pointer_helper<_Tp, _Up*>
{ using type = _Up; };
template<typename _Tp>
struct remove_pointer
: public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
{ };
#endif |
It also compiles with below patch: diff --git a/libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h
index 54390a1939f7..690a58068dd8 100644
--- a/libcxx/include/__type_traits/remove_pointer.h
+++ b/libcxx/include/__type_traits/remove_pointer.h
@@ -24,7 +24,7 @@ struct remove_pointer {
};
template <class _Tp>
-using __remove_pointer_t = __remove_pointer(_Tp);
+using __remove_pointer_t = typename remove_pointer<_Tp>::type;
#else
// clang-format off
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; |
For reference, archlinux and fedora 40 are using gcc 14/14.1. (Fedora)
(Archlinux)
|
Fedora 40 got an update for GCC 14.1:
|
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 llvm#91831.
For the records, I upload the gcc 14 patch to https://github.com/Chilledheart/libcxx/tree/fix_with_gcc14 for any one interested. |
libc++ doesn't compile with GCC 14.1 because it comes with new GCC
__remove_pointer
built-in which is incompatible with libc++.GCC 14.1 is out https://lwn.net/Articles/972683/.
It compiles with below patch:
The text was updated successfully, but these errors were encountered: