[libc++] Upgrade to GCC 15 (#138293)

This commit is contained in:
Nikolas Klauser
2025-06-11 20:19:26 +02:00
committed by GitHub
parent fad1972d74
commit 42c82fcc29
30 changed files with 119 additions and 17 deletions

View File

@@ -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;
});
@@ -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;
});

View File

@@ -26,6 +26,7 @@
#include <vector>
#include "compare_types.h"
#include "test_macros.h"
namespace fundamentals {
static_assert(std::equality_comparable<int>);
@@ -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>);

View File

@@ -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::*)()>());
@@ -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::*)()>());
@@ -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::*)()>());

View File

@@ -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>());

View File

@@ -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::*)()>());
@@ -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::*)()>());

View File

@@ -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>

View File

@@ -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>

View File

@@ -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{{.*}}

View File

@@ -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{{.*}}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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{{.*}}

View File

@@ -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{{.*}}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -8,7 +8,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
// TODO FMT __builtin_memcpy isn't constexpr in GCC
// UNSUPPORTED: gcc-14
// UNSUPPORTED: gcc-14, gcc-15
// <format>

View File

@@ -18,6 +18,8 @@
#include <type_traits>
#include <cassert>
#include "test_macros.h"
template <bool expected, class Base, class Derived>
void test() {
// Test the type of the variables
@@ -98,8 +100,13 @@ int main(int, char**) {
// Test with virtual inheritance
{
#ifdef TEST_COMPILER_GCC // FIXME: Is this a GCC or Clang bug? Or is the standards wording ambiguous?
test<true, Base, Derived3Virtual>();
test<true, Derived, Derived3Virtual>();
#else
test<false, Base, Derived3Virtual>();
test<false, Derived, Derived3Virtual>();
#endif
test<true, Derived2b, Derived3Virtual>();
test<true, Derived2a, Derived3Virtual>();
test<true, Base, DerivedPrivate>();

View File

@@ -168,3 +168,7 @@ void instantiate() {
void_t<int>();
#endif
}
// This is not a .compile.pass.cpp because we want to ensure that GCC doesn't complain about incorrect builtins usage,
// which only happens during CodeGen.
int main(int, char**) { return 0; }

View File

@@ -9,7 +9,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// These compilers don't support __builtin_is_implicit_lifetime yet.
// UNSUPPORTED: clang-18, clang-19, gcc-14, apple-clang-15, apple-clang-16, apple-clang-17
// UNSUPPORTED: clang-18, clang-19, gcc-14, gcc-15, apple-clang-15, apple-clang-16, apple-clang-17
// <type_traits>

View File

@@ -12,6 +12,9 @@
// template <class T, class... Args>
// constexpr optional<T> make_optional(Args&&... args);
// GCC crashes on this file, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120577
// XFAIL: gcc-15
#include <optional>
#include <string>
#include <memory>

View File

@@ -12,6 +12,9 @@
// template <class T, class U, class... Args>
// constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
// GCC crashes on this file, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120577
// XFAIL: gcc-15
#include <cassert>
#include <memory>
#include <optional>

View File

@@ -9,7 +9,7 @@
// UNSUPPORTED: c++03
// FIXME: Why does this start to fail with GCC 14?
// XFAIL: !(c++11 || c++14) && gcc-14
// XFAIL: !(c++11 || c++14) && (gcc-14 || gcc-15)
// See https://llvm.org/PR31384.