After r16-2519-gba5a6787374dea, we should never see a C++20 rewritten
comparison operator expressed as a built-in acting on an operator<=>
call, e.g. operator<=>(x, y) < 0.  This is because operator<=> always
returns a class type (std::strong/weak/partial_ordering), so the < will
necessarily resolve to an operator< for that class type.  So the
corresponding handling in extract_call_expr is dead code -- except for
the TRUTH_NOT_EXPR case, where we can plausibly still have
!(operator==(x, y)), but it doesn't makes sense to recognize just that
one special case of operator rewriting.  So let's remove all this
handling from extract_call_expr.

gcc/cp/ChangeLog:

        * call.cc (extract_call_expr): Remove handling of C++20
        rewritten comparison operators.
---
 gcc/cp/call.cc | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index 0f3143375261..5a53c496c5fb 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -7900,28 +7900,6 @@ extract_call_expr (tree call)
     call = TREE_OPERAND (call, 0);
   if (TREE_CODE (call) == TARGET_EXPR)
     call = TARGET_EXPR_INITIAL (call);
-  if (cxx_dialect >= cxx20)
-    switch (TREE_CODE (call))
-      {
-       /* C++20 rewritten comparison operators.  */
-      case TRUTH_NOT_EXPR:
-       call = TREE_OPERAND (call, 0);
-       break;
-      case LT_EXPR:
-      case LE_EXPR:
-      case GT_EXPR:
-      case GE_EXPR:
-      case SPACESHIP_EXPR:
-       {
-         tree op0 = TREE_OPERAND (call, 0);
-         if (integer_zerop (op0))
-           call = TREE_OPERAND (call, 1);
-         else
-           call = op0;
-       }
-       break;
-      default:;
-      }
 
   if (TREE_CODE (call) != CALL_EXPR
       && TREE_CODE (call) != AGGR_INIT_EXPR
-- 
2.50.1.439.g97e14d99f6

Reply via email to