aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-06-20 22:17:08 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-06-26 21:15:14 +0100
commit6eff23314a7e51715f988acf3c19824fe87b5754 (patch)
treea0e465b716ef42b38019a61b40cc48a0b23a8447
parente65b6627a36869b01bbe128a5324e4b415b28880 (diff)
downloadgcc-6eff23314a7e51715f988acf3c19824fe87b5754.zip
gcc-6eff23314a7e51715f988acf3c19824fe87b5754.tar.gz
gcc-6eff23314a7e51715f988acf3c19824fe87b5754.tar.bz2
libstdc++: Remove duplicate test
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.
-rw-r--r--libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc55
-rw-r--r--libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc7
2 files changed, 5 insertions, 57 deletions
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 2e93aa7..0000000
--- 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 d2e0712..b53db0e 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) { }
};