Skip to content

[libc++] Upgrade to GCC 15 #138293

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
cxx: [ 'clang++-21' ]
include:
- config: 'generic-gcc'
cc: 'gcc-14'
cxx: 'g++-14'
cc: 'gcc-15'
cxx: 'g++-15'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: ${{ matrix.config }}.${{ matrix.cxx }}
Expand Down Expand Up @@ -92,8 +92,8 @@ jobs:
cxx: [ 'clang++-21' ]
include:
- config: 'generic-gcc-cxx11'
cc: 'gcc-14'
cxx: 'g++-14'
cc: 'gcc-15'
cxx: 'g++-15'
- config: 'generic-cxx26'
cc: 'clang-20'
cxx: 'clang++-20'
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Compiler Versions Restrictions Support policy
Clang 19, 20, 21-git latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_ and the development version
AppleClang 15 latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_
Open XL 17.1.3 (AIX) latest stable release per `Open XL's documentation page <https://www.ibm.com/docs/en/openxl-c-and-cpp-aix>`_
GCC 14 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
GCC 15 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
============ =================== ========================== =====================

Libc++ also supports common platforms and architectures:
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__new/allocate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI bool __is_overaligned_for_new(siz

template <class... _Args>
_LIBCPP_HIDE_FROM_ABI void* __libcpp_operator_new(_Args... __args) {
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete) && !defined(_LIBCPP_COMPILER_GCC)
return __builtin_operator_new(__args...);
#else
return ::operator new(__args...);
Expand All @@ -42,7 +42,7 @@ _LIBCPP_HIDE_FROM_ABI void* __libcpp_operator_new(_Args... __args) {

template <class... _Args>
_LIBCPP_HIDE_FROM_ABI void __libcpp_operator_delete(_Args... __args) _NOEXCEPT {
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete) && !defined(_LIBCPP_COMPILER_GCC)
__builtin_operator_delete(__args...);
#else
::operator delete(__args...);
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__type_traits/add_lvalue_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__add_lvalue_reference)
#if __has_builtin(__add_lvalue_reference) && !defined(_LIBCPP_COMPILER_GCC)

template <class _Tp>
using __add_lvalue_reference_t _LIBCPP_NODEBUG = __add_lvalue_reference(_Tp);
Expand Down
3 changes: 2 additions & 1 deletion libcxx/include/__type_traits/add_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer)
#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) && \
!defined(_LIBCPP_COMPILER_GCC)

template <class _Tp>
using __add_pointer_t _LIBCPP_NODEBUG = __add_pointer(_Tp);
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__type_traits/add_rvalue_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__add_rvalue_reference)
#if __has_builtin(__add_rvalue_reference) && !defined(_LIBCPP_COMPILER_GCC)

template <class _Tp>
using __add_rvalue_reference_t _LIBCPP_NODEBUG = __add_rvalue_reference(_Tp);
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__type_traits/decay.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__decay)
#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__type_traits/remove_all_extents.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__remove_all_extents)
#if __has_builtin(__remove_all_extents) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS remove_all_extents {
using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp);
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__type_traits/remove_extent.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__remove_extent)
#if __has_builtin(__remove_extent) && !defined(_LIBCPP_COMPILER_GCC)
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS remove_extent {
using type _LIBCPP_NODEBUG = __remove_extent(_Tp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ constexpr bool test() {
std::string a[] = {str1, str1, str, str1, str1};
auto whole =
std::ranges::subrange(forward_iterator(std::move_iterator(a)), forward_iterator(std::move_iterator(a + 5)));
bool ret = std::ranges::contains(whole.begin(), whole.end(), "hello world", [&](const std::string i) {
bool ret = std::ranges::contains(whole.begin(), whole.end(), +"hello world", [&](const std::string i) {
++projection_count;
return i;
});
Expand All @@ -207,7 +207,7 @@ constexpr bool test() {
std::string a[] = {str1, str1, str, str1, str1};
auto whole =
std::ranges::subrange(forward_iterator(std::move_iterator(a)), forward_iterator(std::move_iterator(a + 5)));
bool ret = std::ranges::contains(whole, "hello world", [&](const std::string i) {
bool ret = std::ranges::contains(whole, +"hello world", [&](const std::string i) {
++projection_count;
return i;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <vector>

#include "compare_types.h"
#include "test_macros.h"

namespace fundamentals {
static_assert(std::equality_comparable<int>);
Expand All @@ -43,7 +44,12 @@ static_assert(std::equality_comparable<unsigned char&&>);
static_assert(std::equality_comparable<unsigned short const&&>);
static_assert(std::equality_comparable<unsigned int volatile&&>);
static_assert(std::equality_comparable<unsigned long const volatile&&>);
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
static_assert(std::equality_comparable<int[5]>);
#else
static_assert(!std::equality_comparable<int[5]>);
#endif
static_assert(std::equality_comparable<int (*)(int)>);
static_assert(std::equality_comparable<int (&)(int)>);
static_assert(std::equality_comparable<int (*)(int) noexcept>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ static_assert(!check_equality_comparable_with < int,
int (S::*)() const volatile&& noexcept > ());

static_assert(check_equality_comparable_with<int*, int*>());
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
static_assert(check_equality_comparable_with<int*, int[5]>());
#else
static_assert(!check_equality_comparable_with<int*, int[5]>());
#endif
static_assert(!check_equality_comparable_with<int*, int (*)()>());
static_assert(!check_equality_comparable_with<int*, int (&)()>());
static_assert(!check_equality_comparable_with<int*, int (S::*)()>());
Expand Down Expand Up @@ -148,7 +153,12 @@ static_assert(
static_assert(!check_equality_comparable_with < int*,
int (S::*)() const volatile&& noexcept > ());

// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
static_assert(check_equality_comparable_with<int[5], int[5]>());
#else
static_assert(!check_equality_comparable_with<int[5], int[5]>());
#endif
static_assert(!check_equality_comparable_with<int[5], int (*)()>());
static_assert(!check_equality_comparable_with<int[5], int (&)()>());
static_assert(!check_equality_comparable_with<int[5], int (S::*)()>());
Expand Down Expand Up @@ -942,7 +952,12 @@ static_assert(

static_assert(!check_equality_comparable_with<std::nullptr_t, int>());
static_assert(check_equality_comparable_with<std::nullptr_t, int*>());
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
static_assert(check_equality_comparable_with<std::nullptr_t, int[5]>());
#else
static_assert(!check_equality_comparable_with<std::nullptr_t, int[5]>());
#endif
static_assert(check_equality_comparable_with<std::nullptr_t, int (*)()>());
static_assert(check_equality_comparable_with<std::nullptr_t, int (&)()>());
static_assert(check_equality_comparable_with<std::nullptr_t, int (S::*)()>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ static_assert(models_totally_ordered<unsigned char&&>());
static_assert(models_totally_ordered<unsigned short const&&>());
static_assert(models_totally_ordered<unsigned int volatile&&>());
static_assert(models_totally_ordered<unsigned long const volatile&&>());
// Array comparisons are ill-formed in C++26
#if TEST_STD_VER <= 23
static_assert(models_totally_ordered<int[5]>());
#endif
static_assert(models_totally_ordered<int (*)(int)>());
static_assert(models_totally_ordered<int (&)(int)>());
static_assert(models_totally_ordered<int (*)(int) noexcept>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ static_assert(!check_totally_ordered_with<int, int (S::*)() const volatile&&>())
static_assert(!check_totally_ordered_with < int, int (S::*)() const volatile&& noexcept > ());

static_assert(check_totally_ordered_with<int*, int*>());
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
static_assert(check_totally_ordered_with<int*, int[5]>());
#else
static_assert(!check_totally_ordered_with<int*, int[5]>());
#endif
static_assert(!check_totally_ordered_with<int*, int (*)()>());
static_assert(!check_totally_ordered_with<int*, int (&)()>());
static_assert(!check_totally_ordered_with<int*, int (S::*)()>());
Expand Down Expand Up @@ -117,7 +122,12 @@ static_assert(!check_totally_ordered_with < int*, int (S::*)() volatile&& noexce
static_assert(!check_totally_ordered_with<int*, int (S::*)() const volatile&&>());
static_assert(!check_totally_ordered_with < int*, int (S::*)() const volatile&& noexcept > ());

// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
static_assert(check_totally_ordered_with<int[5], int[5]>());
#else
static_assert(!check_totally_ordered_with<int[5], int[5]>());
#endif
static_assert(!check_totally_ordered_with<int[5], int (*)()>());
static_assert(!check_totally_ordered_with<int[5], int (&)()>());
static_assert(!check_totally_ordered_with<int[5], int (S::*)()>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// UNSUPPORTED: no-exceptions
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

#include <new>
#include <cassert>
#include <limits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

#include <new>
#include <cstddef>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// UNSUPPORTED: no-exceptions
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
// nor does the dynamic library shipped with z/OS.
// XFAIL: target={{.+}}-zos{{.*}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
// nor does the dynamic library shipped with z/OS.
// XFAIL: target={{.+}}-zos{{.*}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// UNSUPPORTED: no-exceptions
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

#include <new>
#include <cassert>
#include <limits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

#include <new>
#include <cstddef>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// UNSUPPORTED: no-exceptions
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
// nor does the dynamic library shipped with z/OS.
// XFAIL: target={{.+}}-zos{{.*}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete

// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
// nor does the dynamic library shipped with z/OS.
// XFAIL: target={{.+}}-zos{{.*}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// discrete_distribution(size_t nw, double xmin, double xmax,
// UnaryOperation fw);

// There is a bogus diagnostic about a too large allocation
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

#include <random>

#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// param_type(size_t nw, double xmin, double xmax,
// UnaryOperation fw);

// There is a bogus diagnostic about a too large allocation
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than

#include <random>

#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ constexpr bool main_test() {
// Leading separator.
{
std::array expected = {""sv, "abc"sv, "def"sv};
// FIXME: Why does GCC complain here?
#ifndef TEST_COMPILER_GCC
test_one(" abc def"sv, short_sep, expected);
#endif
test_one("12abc12def"sv, long_sep, expected);
}

Expand All @@ -326,7 +329,10 @@ constexpr bool main_test() {
// Input consisting of a single separator.
{
std::array expected = {""sv, ""sv};
// FIXME: Why does GCC complain here?
#ifndef TEST_COMPILER_GCC
test_one(" "sv, short_sep, expected);
#endif
test_one("12"sv, long_sep, expected);
}

Expand Down Expand Up @@ -354,7 +360,10 @@ constexpr bool main_test() {
// Separators after every character.
{
std::array expected = {""sv, "a"sv, "b"sv, "c"sv, ""sv};
// FIXME: Why does GCC complain here?
#ifndef TEST_COMPILER_GCC
test_one(" a b c "sv, short_sep, expected);
#endif
test_one("12a12b12c12"sv, long_sep, expected);
}

Expand Down Expand Up @@ -383,7 +392,10 @@ constexpr bool main_test() {
// Terminating null as a separator.
{
std::array expected = {"abc"sv, "def"sv};
// FIXME: Why does GCC complain here?
#ifndef TEST_COMPILER_GCC
test_one("abc\0def"sv, '\0', expected);
#endif
test_one("abc\0\0def"sv, "\0\0"sv, expected);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// GCC has a issue for `Guaranteed copy elision for potentially-overlapping non-static data members`,
// please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108333
// XFAIL: gcc-14
// please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98995
// XFAIL: gcc-14, gcc-15

// <expected>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// GCC has a issue for `Guaranteed copy elision for potentially-overlapping non-static data members`,
// please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108333.
// XFAIL: gcc-14
// please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98995.
// XFAIL: gcc-14, gcc-15

// <expected>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// GCC has a issue for `Guaranteed copy elision for potentially-overlapping non-static data members`,
// please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108333
// XFAIL: gcc-14
// please refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98995
// XFAIL: gcc-14, gcc-15

// <expected>

Expand Down
Loading
Loading