https://gcc.gnu.org/g:5dce50b6a2d5f2723d886decba35a2c6758b5b9f
commit r16-4265-g5dce50b6a2d5f2723d886decba35a2c6758b5b9f Author: Jonathan Wakely <[email protected]> Date: Thu Oct 2 16:37:33 2025 +0100 libstdc++: Suppress -Wpessimizing-move warnings in shared_ptr tests libstdc++-v3/ChangeLog: * testsuite/20_util/shared_ptr/cons/move.cc: Add comment and dg-prune-output for -Wpessimizing-move warning. * testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc: Likewise. Diff: --- libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc | 2 ++ libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc index 2dc161d641a2..e380d767d52a 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc @@ -140,6 +140,8 @@ test05() { reset_count_struct __attribute__((unused)) reset; + // The std::move here prevents copy elision, so we construct from a prvalue. + // { dg-prune-output "-Wpessimizing-move" } std::shared_ptr<A> a(std::move(std::shared_ptr<A>(new A))); VERIFY( a.use_count() == 1 ); VERIFY( A::ctor_count == 1 ); diff --git a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc index f8ce58e4f094..e414b1f3cea0 100644 --- a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc +++ b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc @@ -106,6 +106,8 @@ test04() { reset_count_struct __attribute__((unused)) reset; + // The std::move here prevents copy elision, so we construct from a prvalue. + // { dg-prune-output "-Wpessimizing-move" } std::experimental::shared_ptr<A[5]> a(std::move(std::experimental ::shared_ptr<A[5]> (new A[5])));
