Skip to content

Commit 6270f5b

Browse files
committed
[libc++] Upgrade to GCC 15
1 parent f2f4eac commit 6270f5b

File tree

36 files changed

+115
-99
lines changed

36 files changed

+115
-99
lines changed

.github/workflows/libcxx-build-and-test.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ jobs:
5252
cxx: [ 'clang++-21' ]
5353
include:
5454
- config: 'generic-gcc'
55-
cc: 'gcc-14'
56-
cxx: 'g++-14'
55+
cc: 'gcc-15'
56+
cxx: 'g++-15'
5757
steps:
5858
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5959
- name: ${{ matrix.config }}.${{ matrix.cxx }}
@@ -92,8 +92,8 @@ jobs:
9292
cxx: [ 'clang++-21' ]
9393
include:
9494
- config: 'generic-gcc-cxx11'
95-
cc: 'gcc-14'
96-
cxx: 'g++-14'
95+
cc: 'gcc-15'
96+
cxx: 'g++-15'
9797
- config: 'generic-cxx26'
9898
cc: 'clang-20'
9999
cxx: 'clang++-20'

libcxx/docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Compiler Versions Restrictions Support policy
134134
Clang 19, 20, 21-git latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_ and the development version
135135
AppleClang 15 latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_
136136
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>`_
137-
GCC 14 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
137+
GCC 15 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
138138
============ =================== ========================== =====================
139139

140140
Libc++ also supports common platforms and architectures:

libcxx/include/__type_traits/add_lvalue_reference.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if __has_builtin(__add_lvalue_reference)
21+
#if __has_builtin(__add_lvalue_reference) && !defined(_LIBCPP_COMPILER_GCC)
2222

2323
template <class _Tp>
2424
using __add_lvalue_reference_t _LIBCPP_NODEBUG = __add_lvalue_reference(_Tp);

libcxx/include/__type_traits/add_pointer.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
_LIBCPP_BEGIN_NAMESPACE_STD
2222

23-
#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer)
23+
#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) && \
24+
!defined(_LIBCPP_COMPILER_GCC)
2425

2526
template <class _Tp>
2627
using __add_pointer_t _LIBCPP_NODEBUG = __add_pointer(_Tp);

libcxx/include/__type_traits/add_rvalue_reference.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if __has_builtin(__add_rvalue_reference)
21+
#if __has_builtin(__add_rvalue_reference) && !defined(_LIBCPP_COMPILER_GCC)
2222

2323
template <class _Tp>
2424
using __add_rvalue_reference_t _LIBCPP_NODEBUG = __add_rvalue_reference(_Tp);

libcxx/include/__type_traits/decay.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
_LIBCPP_BEGIN_NAMESPACE_STD
2727

28-
#if __has_builtin(__decay)
28+
#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC)
2929
template <class _Tp>
3030
using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);
3131

libcxx/include/__type_traits/remove_all_extents.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if __has_builtin(__remove_all_extents)
21+
#if __has_builtin(__remove_all_extents) && !defined(_LIBCPP_COMPILER_GCC)
2222
template <class _Tp>
2323
struct _LIBCPP_NO_SPECIALIZATIONS remove_all_extents {
2424
using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp);

libcxx/include/__type_traits/remove_extent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if __has_builtin(__remove_extent)
21+
#if __has_builtin(__remove_extent) && !defined(_LIBCPP_COMPILER_GCC)
2222
template <class _Tp>
2323
struct _LIBCPP_NO_SPECIALIZATIONS remove_extent {
2424
using type _LIBCPP_NODEBUG = __remove_extent(_Tp);

libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ constexpr bool test() {
195195
std::string a[] = {str1, str1, str, str1, str1};
196196
auto whole =
197197
std::ranges::subrange(forward_iterator(std::move_iterator(a)), forward_iterator(std::move_iterator(a + 5)));
198-
bool ret = std::ranges::contains(whole.begin(), whole.end(), "hello world", [&](const std::string i) {
198+
bool ret = std::ranges::contains(whole.begin(), whole.end(), +"hello world", [&](const std::string i) {
199199
++projection_count;
200200
return i;
201201
});
@@ -207,7 +207,7 @@ constexpr bool test() {
207207
std::string a[] = {str1, str1, str, str1, str1};
208208
auto whole =
209209
std::ranges::subrange(forward_iterator(std::move_iterator(a)), forward_iterator(std::move_iterator(a + 5)));
210-
bool ret = std::ranges::contains(whole, "hello world", [&](const std::string i) {
210+
bool ret = std::ranges::contains(whole, +"hello world", [&](const std::string i) {
211211
++projection_count;
212212
return i;
213213
});

libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <vector>
2727

2828
#include "compare_types.h"
29+
#include "test_macros.h"
2930

3031
namespace fundamentals {
3132
static_assert(std::equality_comparable<int>);
@@ -43,7 +44,12 @@ static_assert(std::equality_comparable<unsigned char&&>);
4344
static_assert(std::equality_comparable<unsigned short const&&>);
4445
static_assert(std::equality_comparable<unsigned int volatile&&>);
4546
static_assert(std::equality_comparable<unsigned long const volatile&&>);
47+
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
48+
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
4649
static_assert(std::equality_comparable<int[5]>);
50+
#else
51+
static_assert(!std::equality_comparable<int[5]>);
52+
#endif
4753
static_assert(std::equality_comparable<int (*)(int)>);
4854
static_assert(std::equality_comparable<int (&)(int)>);
4955
static_assert(std::equality_comparable<int (*)(int) noexcept>);

libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ static_assert(!check_equality_comparable_with < int,
107107
int (S::*)() const volatile&& noexcept > ());
108108

109109
static_assert(check_equality_comparable_with<int*, int*>());
110+
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
111+
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
110112
static_assert(check_equality_comparable_with<int*, int[5]>());
113+
#else
114+
static_assert(!check_equality_comparable_with<int*, int[5]>());
115+
#endif
111116
static_assert(!check_equality_comparable_with<int*, int (*)()>());
112117
static_assert(!check_equality_comparable_with<int*, int (&)()>());
113118
static_assert(!check_equality_comparable_with<int*, int (S::*)()>());
@@ -148,7 +153,12 @@ static_assert(
148153
static_assert(!check_equality_comparable_with < int*,
149154
int (S::*)() const volatile&& noexcept > ());
150155

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

943953
static_assert(!check_equality_comparable_with<std::nullptr_t, int>());
944954
static_assert(check_equality_comparable_with<std::nullptr_t, int*>());
955+
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
956+
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
945957
static_assert(check_equality_comparable_with<std::nullptr_t, int[5]>());
958+
#else
959+
static_assert(!check_equality_comparable_with<std::nullptr_t, int[5]>());
960+
#endif
946961
static_assert(check_equality_comparable_with<std::nullptr_t, int (*)()>());
947962
static_assert(check_equality_comparable_with<std::nullptr_t, int (&)()>());
948963
static_assert(check_equality_comparable_with<std::nullptr_t, int (S::*)()>());

libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.compile.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ static_assert(models_totally_ordered<unsigned char&&>());
5555
static_assert(models_totally_ordered<unsigned short const&&>());
5656
static_assert(models_totally_ordered<unsigned int volatile&&>());
5757
static_assert(models_totally_ordered<unsigned long const volatile&&>());
58+
// Array comparisons are ill-formed in C++26
59+
#if TEST_STD_VER <= 23
5860
static_assert(models_totally_ordered<int[5]>());
61+
#endif
5962
static_assert(models_totally_ordered<int (*)(int)>());
6063
static_assert(models_totally_ordered<int (&)(int)>());
6164
static_assert(models_totally_ordered<int (*)(int) noexcept>());

libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.compile.pass.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ static_assert(!check_totally_ordered_with<int, int (S::*)() const volatile&&>())
8989
static_assert(!check_totally_ordered_with < int, int (S::*)() const volatile&& noexcept > ());
9090

9191
static_assert(check_totally_ordered_with<int*, int*>());
92+
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
93+
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
9294
static_assert(check_totally_ordered_with<int*, int[5]>());
95+
#else
96+
static_assert(!check_totally_ordered_with<int*, int[5]>());
97+
#endif
9398
static_assert(!check_totally_ordered_with<int*, int (*)()>());
9499
static_assert(!check_totally_ordered_with<int*, int (&)()>());
95100
static_assert(!check_totally_ordered_with<int*, int (S::*)()>());
@@ -117,7 +122,12 @@ static_assert(!check_totally_ordered_with < int*, int (S::*)() volatile&& noexce
117122
static_assert(!check_totally_ordered_with<int*, int (S::*)() const volatile&&>());
118123
static_assert(!check_totally_ordered_with < int*, int (S::*)() const volatile&& noexcept > ());
119124

125+
// Array comparisons are ill-formed in C++26, but Clang doesn't implement this yet.
126+
#if TEST_STD_VER <= 23 || defined(TEST_COMPILER_CLANG)
120127
static_assert(check_totally_ordered_with<int[5], int[5]>());
128+
#else
129+
static_assert(!check_totally_ordered_with<int[5], int[5]>());
130+
#endif
121131
static_assert(!check_totally_ordered_with<int[5], int (*)()>());
122132
static_assert(!check_totally_ordered_with<int[5], int (&)()>());
123133
static_assert(!check_totally_ordered_with<int[5], int (S::*)()>());

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size.except.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// UNSUPPORTED: no-exceptions
1010
// UNSUPPORTED: sanitizer-new-delete
1111

12+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
13+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
14+
1215
#include <new>
1316
#include <cassert>
1417
#include <limits>

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// asan and msan will not call the new handler.
1212
// UNSUPPORTED: sanitizer-new-delete
1313

14+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
15+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
16+
1417
#include <new>
1518
#include <cstddef>
1619
#include <cassert>

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.except.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// UNSUPPORTED: no-exceptions
1010
// UNSUPPORTED: sanitizer-new-delete
1111

12+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
13+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
14+
1215
// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
1316
// nor does the dynamic library shipped with z/OS.
1417
// XFAIL: target={{.+}}-zos{{.*}}

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// asan and msan will not call the new handler.
1414
// UNSUPPORTED: sanitizer-new-delete
1515

16+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
17+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
18+
1619
// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
1720
// nor does the dynamic library shipped with z/OS.
1821
// XFAIL: target={{.+}}-zos{{.*}}

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size.except.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// UNSUPPORTED: no-exceptions
1010
// UNSUPPORTED: sanitizer-new-delete
1111

12+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
13+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
14+
1215
#include <new>
1316
#include <cassert>
1417
#include <limits>

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// asan and msan will not call the new handler.
1212
// UNSUPPORTED: sanitizer-new-delete
1313

14+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
15+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
16+
1417
#include <new>
1518
#include <cstddef>
1619
#include <cassert>

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.except.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// UNSUPPORTED: no-exceptions
1010
// UNSUPPORTED: sanitizer-new-delete
1111

12+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
13+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
14+
1215
// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
1316
// nor does the dynamic library shipped with z/OS.
1417
// XFAIL: target={{.+}}-zos{{.*}}

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// asan and msan will not call the new handler.
1414
// UNSUPPORTED: sanitizer-new-delete
1515

16+
// GCC warns about allocating numeric_limits<size_t>::max() being too large (which we test here)
17+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
18+
1619
// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
1720
// nor does the dynamic library shipped with z/OS.
1821
// XFAIL: target={{.+}}-zos{{.*}}

libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/ctor_func.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// discrete_distribution(size_t nw, double xmin, double xmax,
1616
// UnaryOperation fw);
1717

18+
// There is a bogus diagnostic about a too large allocation
19+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
20+
1821
#include <random>
1922

2023
#include <cassert>

libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/param_ctor_func.pass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// param_type(size_t nw, double xmin, double xmax,
1616
// UnaryOperation fw);
1717

18+
// There is a bogus diagnostic about a too large allocation
19+
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-alloc-size-larger-than
20+
1821
#include <random>
1922

2023
#include <cassert>

libcxx/test/std/ranges/range.adaptors/range.lazy.split/general.pass.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ constexpr bool main_test() {
312312
// Leading separator.
313313
{
314314
std::array expected = {""sv, "abc"sv, "def"sv};
315+
// FIXME: Why does GCC complain here?
316+
#ifndef TEST_COMPILER_GCC
315317
test_one(" abc def"sv, short_sep, expected);
318+
#endif
316319
test_one("12abc12def"sv, long_sep, expected);
317320
}
318321

@@ -326,7 +329,10 @@ constexpr bool main_test() {
326329
// Input consisting of a single separator.
327330
{
328331
std::array expected = {""sv, ""sv};
332+
// FIXME: Why does GCC complain here?
333+
#ifndef TEST_COMPILER_GCC
329334
test_one(" "sv, short_sep, expected);
335+
#endif
330336
test_one("12"sv, long_sep, expected);
331337
}
332338

@@ -354,7 +360,10 @@ constexpr bool main_test() {
354360
// Separators after every character.
355361
{
356362
std::array expected = {""sv, "a"sv, "b"sv, "c"sv, ""sv};
363+
// FIXME: Why does GCC complain here?
364+
#ifndef TEST_COMPILER_GCC
357365
test_one(" a b c "sv, short_sep, expected);
366+
#endif
358367
test_one("12a12b12c12"sv, long_sep, expected);
359368
}
360369

@@ -383,7 +392,10 @@ constexpr bool main_test() {
383392
// Terminating null as a separator.
384393
{
385394
std::array expected = {"abc"sv, "def"sv};
395+
// FIXME: Why does GCC complain here?
396+
#ifndef TEST_COMPILER_GCC
386397
test_one("abc\0def"sv, '\0', expected);
398+
#endif
387399
test_one("abc\0\0def"sv, "\0\0"sv, expected);
388400
}
389401

libcxx/test/std/utilities/expected/expected.expected/monadic/transform.pass.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1010

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

1515
// <expected>
1616

libcxx/test/std/utilities/expected/expected.expected/monadic/transform_error.pass.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1010

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

1515
// <expected>
1616

libcxx/test/std/utilities/expected/expected.void/monadic/transform_error.pass.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1010

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

1515
// <expected>
1616

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// UNSUPPORTED: c++03, c++11, c++14, c++17
1010
// TODO FMT __builtin_memcpy isn't constexpr in GCC
11-
// UNSUPPORTED: gcc-14
11+
// UNSUPPORTED: gcc-14, gcc-15
1212

1313
// <format>
1414

0 commit comments

Comments
 (0)