]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix failures in new std::complex test [PR119144]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 6 Mar 2025 16:04:05 +0000 (16:04 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 6 Mar 2025 16:08:02 +0000 (16:08 +0000)
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.

libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc

index 7d8d2ee99ce79bbc75d17abe3db68a5a92e2314a..1150861ae0aa4ed3fa9ee2e524d95bfffe036021 100644 (file)
@@ -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)