diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-03-06 11:24:03 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-03-06 12:00:11 +0000 |
commit | 6eede5ad12415055ee54e5cb3218a340d383183c (patch) | |
tree | c703bd066d86c3732e3cecfc7e6a48ab48706cf0 | |
parent | d6d7da92fb598c50d25332011bffe6b6515c9669 (diff) | |
download | gcc-6eede5ad12415055ee54e5cb3218a340d383183c.zip gcc-6eede5ad12415055ee54e5cb3218a340d383183c.tar.gz gcc-6eede5ad12415055ee54e5cb3218a340d383183c.tar.bz2 |
libstdc++: Fix constexpr memory algo tests for COW std::string
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>
5 files changed, 10 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constexpr.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constexpr.cc index 6f05b0c..faf6968 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constexpr.cc @@ -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}}); } diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constexpr.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constexpr.cc index db39c8b..151c1f9 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constexpr.cc @@ -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>>(); } diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constexpr.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constexpr.cc index e43cd35..27461fa 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constexpr.cc @@ -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); diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constexpr.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constexpr.cc index 47403ae..f122a03 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constexpr.cc @@ -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)); } diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constexpr.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constexpr.cc index 55dfc59..f943973 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constexpr.cc @@ -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>>(); } |