]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix constexpr memory algo tests for COW std::string
authorJonathan Wakely <jwakely@redhat.com>
Thu, 6 Mar 2025 11:24:03 +0000 (11:24 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 6 Mar 2025 12:00:11 +0000 (12:00 +0000)
The old COW std::string is not usable in constant expressions, so these
new tests fail with -D_GLIBCXX_USE_CXX11_ABI=0.

The parts of the tests using std::string can be conditionally skipped.

libstdc++-v3/ChangeLog:

* testsuite/20_util/specialized_algorithms/uninitialized_copy/constexpr.cc:
Do not test COW std::string in constexpr contexts.
* testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constexpr.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_fill/constexpr.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_move/constexpr.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constexpr.cc:
Likewise.

Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constexpr.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constexpr.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constexpr.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constexpr.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constexpr.cc

index 6f05b0ce309d5d534c6155f0d26d3881887488d7..faf69689ee7ffa62749d843f11600487e864ff2a 100644 (file)
@@ -51,7 +51,9 @@ test01()
     test01_impl<char>({'a', 'b', 'c'}) &&
     test01_impl<int>({1, 2, 3, 4}) &&
     test01_impl<double>({1.0, 2.0, 3.0, 4.0}) &&
+#if _GLIBCXX_USE_CXX11_ABI
     test01_impl<std::string>({"a", "b", "cc", "dddd", "eeeeeeeeeeeeeeee"}) &&
+#endif
     test01_impl<std::vector<int>>({ {0}, {0, 1}, {0, 1, 2}});
 }
 
index db39c8b4d05183958299eb19fdd9311d401c7cd0..151c1f95a30d26502b5de5e56485852a35614ab4 100644 (file)
@@ -59,7 +59,9 @@ test01()
     test01_impl<char>() &&
     test01_impl<int>() &&
     test01_impl<double>() &&
+#if _GLIBCXX_USE_CXX11_ABI
     test01_impl<std::string>() &&
+#endif
     test01_impl<std::vector<int>>() &&
     test01_impl<std::unique_ptr<int>>();
 }
index e43cd35a92d92f9df7522b960cfa1206445b09b9..27461fa452ec3510a940c9999452ed760023cdf7 100644 (file)
@@ -58,8 +58,10 @@ test01()
     test01_impl<int>(0) &&
     test01_impl<int>(42) &&
     test01_impl<double>(3.14) &&
+#if _GLIBCXX_USE_CXX11_ABI
     test01_impl<std::string>() &&
     test01_impl<std::string>(std::string("test")) &&
+#endif
     test01_impl<std::vector<int>>() &&
     test01_impl<std::vector<int>>({1, 2, 3, 4}) &&
     test01_impl<std::unique_ptr<int>>(nullptr);
index 47403ae706dc44135f930c7bf3bbe08013ae72d5..f122a03991fcaff7b6ae3aed1817c55b772bec87 100644 (file)
@@ -43,7 +43,9 @@ test01()
     test01_impl<char>({'a', 'b', 'c'}) &&
     test01_impl<int>({1, 2, 3, 4}) &&
     test01_impl<double>({1.0, 2.0, 3.0, 4.0}) &&
+#if _GLIBCXX_USE_CXX11_ABI
     test01_impl<std::string>({"a", "b", "cc", "dddd", "eeeeeeeeeeeeeeee"}) &&
+#endif
     test01_impl<std::vector<int>>({ {0}, {0, 1}, {0, 1, 2}}) &&
     test01_impl<std::unique_ptr<int>>(std::vector<std::unique_ptr<int>>(10));
 }
index 55dfc59b5ef352d27f9fb1e1b9948c1cebb0213d..f943973b015444ef151a1042d82f4e5a5cb3481a 100644 (file)
@@ -56,7 +56,9 @@ test01()
     test01_impl<char>() &&
     test01_impl<int>() &&
     test01_impl<double>() &&
+#if _GLIBCXX_USE_CXX11_ABI
     test01_impl<std::string>() &&
+#endif
     test01_impl<std::vector<int>>() &&
     test01_impl<std::unique_ptr<int>>();
 }