https://gcc.gnu.org/g:6eede5ad12415055ee54e5cb3218a340d383183c
commit r15-7855-g6eede5ad12415055ee54e5cb3218a340d383183c Author: Jonathan Wakely <jwak...@redhat.com> Date: Thu Mar 6 11:24:03 2025 +0000 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.dang...@kdab.com> Diff: --- .../20_util/specialized_algorithms/uninitialized_copy/constexpr.cc | 2 ++ .../specialized_algorithms/uninitialized_default_construct/constexpr.cc | 2 ++ .../20_util/specialized_algorithms/uninitialized_fill/constexpr.cc | 2 ++ .../20_util/specialized_algorithms/uninitialized_move/constexpr.cc | 2 ++ .../specialized_algorithms/uninitialized_value_construct/constexpr.cc | 2 ++ 5 files changed, 10 insertions(+) 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 6f05b0ce309d..faf69689ee7f 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 db39c8b4d051..151c1f95a30d 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 e43cd35a92d9..27461fa452ec 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 47403ae706dc..f122a03991fc 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 55dfc59b5ef3..f943973b0154 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>>(); }