[llvm] 94d6699 - Revert "[STLExtras] Remove incorrect hack to make indexed_accessor_range operator== compatible with C++20" (#72265)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 07:07:31 PST 2023


Author: Utkarsh Saxena
Date: 2023-11-14T16:07:27+01:00
New Revision: 94d6699bf5eeb5aa4c50d1d90f8bf69b79201ceb

URL: https://github.com/llvm/llvm-project/commit/94d6699bf5eeb5aa4c50d1d90f8bf69b79201ceb
DIFF: https://github.com/llvm/llvm-project/commit/94d6699bf5eeb5aa4c50d1d90f8bf69b79201ceb.diff

LOG: Revert "[STLExtras] Remove incorrect hack to make indexed_accessor_range operator== compatible with C++20" (#72265)

Reverts llvm/llvm-project#72220

This breaks C++20 build bot. Need to see if upgrading to clang-17 in the
build bot would solve the issue.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index e42b0e8d1b27b71..18bc4d108b156bf 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -1291,11 +1291,15 @@ class indexed_accessor_range_base {
   }
 
   /// Compare this range with another.
-  template <typename OtherT> bool operator==(const OtherT &rhs) const {
-    return std::equal(begin(), end(), rhs.begin(), rhs.end());
-  }
-  template <typename OtherT> bool operator!=(const OtherT &rhs) const {
-    return !(*this == rhs);
+  template <typename OtherT>
+  friend bool operator==(const indexed_accessor_range_base &lhs,
+                         const OtherT &rhs) {
+    return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
+  }
+  template <typename OtherT>
+  friend bool operator!=(const indexed_accessor_range_base &lhs,
+                         const OtherT &rhs) {
+    return !(lhs == rhs);
   }
 
   /// Return the size of this range.


        


More information about the llvm-commits mailing list