[PATCH] libstdc++: remove redundant equality operators

Jonathan Wakely jwakely@redhat.com
Wed Nov 6 17:52:00 GMT 2019


Now that operator<=> is supported, these operators can be generated by
the compiler.

	* include/bits/iterator_concepts.h (unreachable_sentinel_t): Remove
	redundant equality operators.
	* testsuite/util/testsuite_iterators.h (test_range::sentinel):
	Likewise.

Tested powerpc64le-linux, committed to trunk.


-------------- next part --------------
commit f11a631b97047ef97d7658ca6aebeb392d55f2b3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Nov 6 00:53:23 2019 +0000

    libstdc++: remove redundant equality operators
    
    Now that operator<=> is supported, these operators can be generated by
    the compiler.
    
            * include/bits/iterator_concepts.h (unreachable_sentinel_t): Remove
            redundant equality operators.
            * testsuite/util/testsuite_iterators.h (test_range::sentinel):
            Likewise.

diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h
index e30645e05cf..8b398616a56 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -797,23 +797,6 @@ namespace ranges
       friend constexpr bool
       operator==(unreachable_sentinel_t, const _It&) noexcept
       { return false; }
-
-#ifndef __cpp_lib_three_way_comparison
-    template<weakly_incrementable _It>
-      friend constexpr bool
-      operator!=(unreachable_sentinel_t, const _It&) noexcept
-      { return true; }
-
-    template<weakly_incrementable _It>
-      friend constexpr bool
-      operator==(const _It&, unreachable_sentinel_t) noexcept
-      { return false; }
-
-    template<weakly_incrementable _It>
-      friend constexpr bool
-      operator!=(const _It&, unreachable_sentinel_t) noexcept
-      { return true; }
-#endif
   };
 
   inline constexpr unreachable_sentinel_t unreachable_sentinel{};
diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h
index d20257c1b31..4c5e9a3cc1d 100644
--- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
+++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
@@ -677,15 +677,6 @@ namespace __gnu_test
 
 	  friend bool operator==(const sentinel& s, const I& i)
 	  { return s.end == i.ptr; }
-
-	  friend bool operator!=(const sentinel& s, const I& i)
-	  { return !(s == i); }
-
-	  friend bool operator==(const I& i, const sentinel& s)
-	  { return s == i; }
-
-	  friend bool operator!=(const I& i, const sentinel& s)
-	  { return !(s == i); }
 	};
 
       auto


More information about the Gcc-patches mailing list