]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Suppress -Wpessimizing-move warnings in shared_ptr tests
authorJonathan Wakely <jwakely@redhat.com>
Thu, 2 Oct 2025 15:37:33 +0000 (16:37 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 7 Oct 2025 11:12:39 +0000 (12:12 +0100)
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.

libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc
libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc

index 2dc161d641a2f61a4e39459ba9ef396b83647a85..e380d767d52a19c5ae7ebdd8c628c30ccfada0fa 100644 (file)
@@ -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 );
index f8ce58e4f094e247f7bcf5d1fdacd8e36983aeb8..e414b1f3cea0f413dca75bf5af9dcca4336d59fb 100644 (file)
@@ -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])));