[gcc r15-7863] libstdc++: Fix failures in new std::complex test [PR119144]
Jonathan Wakely
redi@gcc.gnu.org
Thu Mar 6 16:09:06 GMT 2025
https://gcc.gnu.org/g:d2b022e38a778d64350f4d4236a2c8a36e0e621c
commit r15-7863-gd2b022e38a778d64350f4d4236a2c8a36e0e621c
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Mar 6 16:04:05 2025 +0000
libstdc++: Fix failures in new std::complex test [PR119144]
This test fails due to duplicate explicit instantiations on targets
where size_t and unsigned int are the same type. It also fails with
-D_GLIBCXX_USE_CXX11_ABI=0 due to using std::string in constexpr
functions, and with --disable-libstdcxx-pch due to not including
<algorithm> for ranges::fold_left.
libstdc++-v3/ChangeLog:
PR libstdc++/119144
* testsuite/26_numerics/complex/tuple_like.cc: Include
<algorithm>, replace std::string with std::string_view,
instantiate tests for long instead of size_t.
Diff:
---
libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc b/libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc
index 7d8d2ee99ce7..1150861ae0aa 100644
--- a/libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc
+++ b/libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc
@@ -2,7 +2,8 @@
#include <complex>
#include <ranges>
-#include <string>
+#include <algorithm>
+#include <string_view>
#include <type_traits>
#include <tuple>
#include <utility>
@@ -83,10 +84,10 @@ void
test_tuple_cat()
{
std::complex<T> cpx(T(1), T(2));
- std::pair<int, std::string> p(42, "hello");
+ std::pair<int, std::string_view> p(42, "hello");
auto r = std::tuple_cat(cpx, p, cpx);
- static_assert(std::is_same_v<decltype(r), std::tuple<T, T, int, std::string, T, T>>);
+ static_assert(std::is_same_v<decltype(r), std::tuple<T, T, int, std::string_view, T, T>>);
VERIFY(std::get<0>(r) == T(1));
VERIFY(std::get<1>(r) == T(2));
VERIFY(std::get<2>(r) == 42);
@@ -176,4 +177,4 @@ TEST(__gnu_cxx::__bfloat16_t)
TEST(char)
TEST(int)
TEST(unsigned int)
-TEST(size_t)
+TEST(long)
More information about the Libstdc++-cvs
mailing list