diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-03-06 16:04:05 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-03-06 16:08:02 +0000 |
commit | d2b022e38a778d64350f4d4236a2c8a36e0e621c (patch) | |
tree | 69418b7e8dc5a2f6798994655c93e47cdbd99084 | |
parent | 2c6ab4c443ae32782579f9bf948e9cef4e812ace (diff) | |
download | gcc-d2b022e38a778d64350f4d4236a2c8a36e0e621c.zip gcc-d2b022e38a778d64350f4d4236a2c8a36e0e621c.tar.gz gcc-d2b022e38a778d64350f4d4236a2c8a36e0e621c.tar.bz2 |
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.
-rw-r--r-- | libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc | 9 |
1 files 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 7d8d2ee..1150861 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) |