diff mbox series

[committed] libstdc++: Remove duplicate test

Message ID 20240626202337.72113-1-jwakely@redhat.com
State New
Headers show
Series [committed] libstdc++: Remove duplicate test | expand

Commit Message

Jonathan Wakely June 26, 2024, 8:23 p.m. UTC
Tested x86_64-linux. Pushed to trunk.

-- >8 --

We currently have 808590.cc which only runs for C++98 mode, and
808590-cxx11.cc which only runs for C++11 and later, but have almost
identical content (except for a defaulted special member in the C++11
one, to suppress a -Wdeprecated-copy warning).

This was done originally to ensure that the test ran for both C++98 mode
and C++11 mode, because the logic being tested was different enough to
need both to be tested. But it's trivial to run all tests in multiple
-std modes now, using GLIBCXX_TESTSUITE_STDS, so we don't need two
separate tests. We can remove one of the tests and allow the other one
to run in any -std mode.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc:
	Copy defaulted assignment operator from 808590-cxx11.cc to
	suppress a warning.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc:
	Removed.
---
 .../uninitialized_copy/808590-cxx11.cc        | 55 -------------------
 .../uninitialized_copy/808590.cc              |  7 ++-
 2 files changed, 5 insertions(+), 57 deletions(-)
 delete mode 100644 libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc
diff mbox series

Patch

diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc
deleted file mode 100644
index 2e93aa75738..00000000000
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc
+++ /dev/null
@@ -1,55 +0,0 @@ 
-// Copyright (C) 2012-2024 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3.  If not see
-// <http://www.gnu.org/licenses/>.
-
-// { dg-do run { target c++11 } }
-
-// This is identical to ./808590.cc but for C++11 and later.
-// See https://gcc.gnu.org/ml/libstdc++/2014-05/msg00027.html
-
-#include <vector>
-#include <stdexcept>
-
-// 4.4.x only
-struct c
-{
-  void *m;
-
-  c(void* o = 0) : m(o) {}
-  c(const c &r) : m(r.m) {}
-
-  c& operator=(const c &) = default;
-
-  template<class T>
-    explicit c(T &o) : m((void*)0xdeadbeef) { }
-};
-
-int main()
-{
-  std::vector<c> cbs;
-  const c cb((void*)0xcafebabe);
-
-  for (int fd = 62; fd < 67; ++fd)
-    {
-      cbs.resize(fd + 1);
-      cbs[fd] = cb;
-    }
-
-  for (int fd = 62; fd< 67; ++fd)
-    if (cb.m != cbs[fd].m)
-      throw std::runtime_error("wrong");
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
index d2e07127323..b53db0e154d 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
@@ -15,8 +15,6 @@ 
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=gnu++98" }
-
 #include <vector>
 #include <stdexcept>
 
@@ -28,6 +26,11 @@  struct c
   c(void* o = 0) : m(o) {}
   c(const c &r) : m(r.m) {}
 
+#if __cplusplus >= 201103L
+  // Avoid -Wdeprecated-copy warning.
+  c& operator=(const c &) = default;
+#endif
+
   template<class T>
     explicit c(T &o) : m((void*)0xdeadbeef) { }
 };