This is deprecated in the C++20 standard and will be removed at some
point.
libstdc++-v3/ChangeLog:
* include/bits/stl_relops.h (rel_ops): Add deprecated attribute.
* testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc:
Add dg-warning for -Wdeprecated warnings.
* testsuite/20_util/rel_ops.cc: Likewise.
* testsuite/util/testsuite_containers.h: Disable -Wdeprecated
warnings when using rel_ops.
---
Nobody should be using this namespace in any version of C++, ever.
Tested x86_64-linux. Pushed to trunk.
libstdc++-v3/include/bits/stl_relops.h | 2 +-
.../headers/utility/using_namespace_std_rel_ops.cc | 2 +-
libstdc++-v3/testsuite/20_util/rel_ops.cc | 2 +-
libstdc++-v3/testsuite/util/testsuite_containers.h | 9 +++++++++
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/libstdc++-v3/include/bits/stl_relops.h
b/libstdc++-v3/include/bits/stl_relops.h
index 06c85ca8da9..29e7af3c250 100644
--- a/libstdc++-v3/include/bits/stl_relops.h
+++ b/libstdc++-v3/include/bits/stl_relops.h
@@ -63,7 +63,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- namespace rel_ops
+ namespace rel_ops _GLIBCXX20_DEPRECATED_SUGGEST("<=>")
{
/** @namespace std::rel_ops
* @brief The generated relational operators are sequestered here.
diff --git
a/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
b/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
index 330bde88d63..b583eaa4713 100644
---
a/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
+++
b/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
@@ -21,5 +21,5 @@
namespace gnu
{
- using namespace std::rel_ops;
+ using namespace std::rel_ops; // { dg-warning "deprecated" "" { target c++20
} }
}
diff --git a/libstdc++-v3/testsuite/20_util/rel_ops.cc
b/libstdc++-v3/testsuite/20_util/rel_ops.cc
index 711822966d3..f84503293e1 100644
--- a/libstdc++-v3/testsuite/20_util/rel_ops.cc
+++ b/libstdc++-v3/testsuite/20_util/rel_ops.cc
@@ -24,7 +24,7 @@
#include <utility>
#include <vector>
-using namespace std::rel_ops;
+using namespace std::rel_ops; // { dg-warning "deprecated" "" { target c++20 }
}
// libstdc++/3628
void test01()
diff --git a/libstdc++-v3/testsuite/util/testsuite_containers.h
b/libstdc++-v3/testsuite/util/testsuite_containers.h
index 4dd78d4ec9d..f48bb54f140 100644
--- a/libstdc++-v3/testsuite/util/testsuite_containers.h
+++ b/libstdc++-v3/testsuite/util/testsuite_containers.h
@@ -183,9 +183,12 @@ namespace __gnu_test
{
forward_members_unordered(const typename _Tp::value_type& v)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Make sure that even if rel_ops is injected there is no ambiguity
// when comparing iterators.
using namespace std::rel_ops;
+#pragma GCC diagnostic pop
typedef _Tp test_type;
test_type container;
@@ -283,9 +286,12 @@ namespace __gnu_test
{
forward_members(_Tp& container)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Make sure that even if rel_ops is injected there is no ambiguity
// when comparing iterators.
using namespace std::rel_ops;
+#pragma GCC diagnostic pop
typedef traits<_Tp> traits_type;
iterator_concept_checks<typename _Tp::iterator,
@@ -318,9 +324,12 @@ namespace __gnu_test
category_members(_Tp& container)
: forward_members<_Tp>(container)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Make sure that even if rel_ops is injected there is no ambiguity
// when comparing iterators.
using namespace std::rel_ops;
+#pragma GCC diagnostic pop
assert( !(container.begin() < container.begin()) );
assert( !(container.cbegin() < container.cbegin()) );
--
2.47.0