| Issue |
174203
|
| Summary |
libc++ 21 doesn't compile with gcc 14, even though it should be supported
|
| Labels |
libc++
|
| Assignees |
|
| Reporter |
DimitryAndric
|
In 9e9404387d3b787305dc8bf21b0e20c477b6ff39 libc++ 21 has been marked compatible with gcc 14 and higher. However, if I attempt to build libc++ from the release/21.x branch with gcc 14, I get lots of errors:
```
$ cmake -G Ninja -D CMAKE_C_COMPILER=gcc15 -D CMAKE_CXX_COMPILER=g++15 ~/src/llvm-project/libcxx
...
$ ninja -v
...
FAILED: [code=1] src/CMakeFiles/cxx_shared.dir/new_helpers.cpp.o
/usr/local/bin/g++14 -DLIBCXXRT -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -I/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src -I/home/dim/obj/libcxx-gcc14/include/c++/v1 -I/home/dim/obj/libcxx-gcc14/private-abi-headers -I/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/cmake/Modules/../../libc -std=c++23 -fPIC -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wformat-nonliteral -Wno-nullability-completeness -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wno-attributes -Wno-literal-suffix -Wno-c++14-compat -Wno-noexcept-type -Wno-suggest-override -Wno-alloc-size-larger-than -Wno-deprecated-declarations -Wno-dangling-reference -Wno-strict-overflow -Wno-maybe-uninitialized -Wno-strict-aliasing -Wno-error -fdebug-prefix-map=/home/dim/obj/libcxx-gcc14/include/c++/v1=/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/include -MD -MT src/CMakeFiles/cxx_shared.dir/new_helpers.cpp.o -MF src/CMakeFiles/cxx_shared.dir/new_helpers.cpp.o.d -o src/CMakeFiles/cxx_shared.dir/new_helpers.cpp.o -c /share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src/new_helpers.cpp
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/new:94,
from /share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src/new_helpers.cpp:10:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h: In function '_Tp* std::__1::__libcpp_allocate(__element_count, size_t)':
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h:40:30: error: there are no arguments to '__builtin_operator_new' that depend on a template parameter, so a declaration of '__builtin_operator_new' must be available [-fpermissive]
40 | return static_cast<_Tp*>(__builtin_operator_new(__size, static_cast<align_val_t>(__align)));
| ^~~~~~~~~~~~~~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h:40:30: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h:43:28: error: there are no arguments to '__builtin_operator_new' that depend on a template parameter, so a declaration of '__builtin_operator_new' must be available [-fpermissive]
43 | return static_cast<_Tp*>(__builtin_operator_new(__size));
| ^~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-nullability-completeness' may have been intended to silence earlier diagnostics
[ 88% 1711/1921] /usr/local/bin/g++14 -DLIBCXXRT -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -I/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src -I/home/dim/obj/libcxx-gcc14/include/c++/v1 -I/home/dim/obj/libcxx-gcc14/private-abi-headers -I/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/cmake/Modules/../../libc -std=c++23 -fPIC -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wformat-nonliteral -Wno-nullability-completeness -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wno-attributes -Wno-literal-suffix -Wno-c++14-compat -Wno-noexcept-type -Wno-suggest-override -Wno-alloc-size-larger-than -Wno-deprecated-declarations -Wno-dangling-reference -Wno-strict-overflow -Wno-maybe-uninitialized -Wno-strict-aliasing -Wno-error -fdebug-prefix-map=/home/dim/obj/libcxx-gcc14/include/c++/v1=/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/include -MD -MT src/CMakeFiles/cxx_shared.dir/any.cpp.o -MF src/CMakeFiles/cxx_shared.dir/any.cpp.o.d -o src/CMakeFiles/cxx_shared.dir/any.cpp.o -c /share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src/any.cpp
FAILED: [code=1] src/CMakeFiles/cxx_shared.dir/any.cpp.o
/usr/local/bin/g++14 -DLIBCXXRT -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -I/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src -I/home/dim/obj/libcxx-gcc14/include/c++/v1 -I/home/dim/obj/libcxx-gcc14/private-abi-headers -I/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/cmake/Modules/../../libc -std=c++23 -fPIC -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wformat-nonliteral -Wno-nullability-completeness -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wno-attributes -Wno-literal-suffix -Wno-c++14-compat -Wno-noexcept-type -Wno-suggest-override -Wno-alloc-size-larger-than -Wno-deprecated-declarations -Wno-dangling-reference -Wno-strict-overflow -Wno-maybe-uninitialized -Wno-strict-aliasing -Wno-error -fdebug-prefix-map=/home/dim/obj/libcxx-gcc14/include/c++/v1=/share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/include -MD -MT src/CMakeFiles/cxx_shared.dir/any.cpp.o -MF src/CMakeFiles/cxx_shared.dir/any.cpp.o.d -o src/CMakeFiles/cxx_shared.dir/any.cpp.o -c /share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src/any.cpp
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/pointer_traits.h:18,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocator_traits.h:17,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocate_at_least.h:14,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocator.h:17,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/any:87,
from /share/dim/src/llvm/llvmorg-21.1.7-0-g292dc2b86f66/libcxx/src/any.cpp:9:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/decay.h:22:32: error: expected type-specifier before '__decay'
22 | using type _LIBCPP_NODEBUG = __decay(_Tp);
| ^~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_constructible.h:13,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocator_traits.h:20:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/add_reference.h:22:32: error: expected type-specifier before '__add_lvalue_reference'
22 | using type _LIBCPP_NODEBUG = __add_lvalue_reference(_Tp);
| ^~~~~~~~~~~~~~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/add_reference.h:40:32: error: expected type-specifier before '__add_rvalue_reference'
40 | using type _LIBCPP_NODEBUG = __add_rvalue_reference(_Tp);
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocator.h:19:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h: In function '_Tp* std::__1::__libcpp_allocate(__element_count, size_t)':
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h:40:30: error: there are no arguments to '__builtin_operator_new' that depend on a template parameter, so a declaration of '__builtin_operator_new' must be available [-fpermissive]
40 | return static_cast<_Tp*>(__builtin_operator_new(__size, static_cast<align_val_t>(__align)));
| ^~~~~~~~~~~~~~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h:40:30: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/dim/obj/libcxx-gcc14/include/c++/v1/__new/allocate.h:43:28: error: there are no arguments to '__builtin_operator_new' that depend on a template parameter, so a declaration of '__builtin_operator_new' must be available [-fpermissive]
43 | return static_cast<_Tp*>(__builtin_operator_new(__size));
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocator.h:21:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_const.h: At global scope:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_const.h:22:60: error: there are no arguments to '__is_const' that depend on a template parameter, so a declaration of '__is_const' must be available [-fpermissive]
22 | struct _LIBCPP_NO_SPECIALIZATIONS is_const : _BoolConstant<__is_const(_Tp)> {};
| ^~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_const.h:22:75: error: template argument 1 is invalid
22 | struct _LIBCPP_NO_SPECIALIZATIONS is_const : _BoolConstant<__is_const(_Tp)> {};
| ^
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_const.h:26:77: error: expected primary-_expression_ before ')' token
26 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_const_v = __is_const(_Tp);
| ^
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_const.h:26:63: error: there are no arguments to '__is_const' that depend on a template parameter, so a declaration of '__is_const' must be available [-fpermissive]
26 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_const_v = __is_const(_Tp);
| ^~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/allocator.h:25:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_volatile.h:22:63: error: there are no arguments to '__is_volatile' that depend on a template parameter, so a declaration of '__is_volatile' must be available [-fpermissive]
22 | struct _LIBCPP_NO_SPECIALIZATIONS is_volatile : _BoolConstant<__is_volatile(_Tp)> {};
| ^~~~~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_volatile.h:22:81: error: template argument 1 is invalid
22 | struct _LIBCPP_NO_SPECIALIZATIONS is_volatile : _BoolConstant<__is_volatile(_Tp)> {};
| ^
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_volatile.h:26:83: error: expected primary-_expression_ before ')' token
26 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_volatile_v = __is_volatile(_Tp);
| ^
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_volatile.h:26:66: error: there are no arguments to '__is_volatile' that depend on a template parameter, so a declaration of '__is_volatile' must be available [-fpermissive]
26 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_volatile_v = __is_volatile(_Tp);
| ^~~~~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/common_reference.h:13,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__concepts/common_reference_with.h:15,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__compare/three_way_comparable.h:14,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__compare/compare_three_way.h:13,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/unique_ptr.h:14,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/any:90:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/add_pointer.h:27:32: error: expected type-specifier before '__add_pointer'
27 | using type _LIBCPP_NODEBUG = __add_pointer(_Tp);
| ^~~~~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_destructible.h:16,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_trivially_destructible.h:14,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/array_cookie.h:18,
from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/unique_ptr.h:23:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/remove_all_extents.h:22:32: error: expected type-specifier before '__remove_all_extents'
22 | using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp);
| ^~~~~~~~~~~~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/unique_ptr.h:40:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_pointer.h:22:62: error: there are no arguments to '__is_pointer' that depend on a template parameter, so a declaration of '__is_pointer' must be available [-fpermissive]
22 | struct _LIBCPP_NO_SPECIALIZATIONS is_pointer : _BoolConstant<__is_pointer(_Tp)> {};
| ^~~~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_pointer.h:22:79: error: template argument 1 is invalid
22 | struct _LIBCPP_NO_SPECIALIZATIONS is_pointer : _BoolConstant<__is_pointer(_Tp)> {};
| ^
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_pointer.h:26:81: error: expected primary-_expression_ before ')' token
26 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_pointer_v = __is_pointer(_Tp);
| ^
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_pointer.h:26:65: error: there are no arguments to '__is_pointer' that depend on a template parameter, so a declaration of '__is_pointer' must be available [-fpermissive]
26 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_pointer_v = __is_pointer(_Tp);
| ^~~~~~~~~~~~
In file included from /home/dim/obj/libcxx-gcc14/include/c++/v1/__memory/unique_ptr.h:48:
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/remove_extent.h:22:32: error: expected type-specifier before '__remove_extent'
22 | using type _LIBCPP_NODEBUG = __remove_extent(_Tp);
| ^~~~~~~~~~~~~~~
/home/dim/obj/libcxx-gcc14/include/c++/v1/__type_traits/is_constructible.h: In instantiation of 'struct std::__<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs