[compiler-rt] Replace bool operator== for VersionType in sanitizer_mac.h (PR #135068)

Walter Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 13:54:21 PDT 2025


================
@@ -37,8 +37,8 @@ struct VersionBase {
 
   VersionBase(u16 major, u16 minor) : major(major), minor(minor) {}
 
-  bool operator==(const VersionType &other) const {
-    return major == other.major && minor == other.minor;
+  friend bool operator==(const VersionType &self, const VersionType &other) {
----------------
googlewalt wrote:

You want a standalone function, defined outside of the struct:

template <typename VersionType>
bool operator==(const VersionType &self, const VersionType &other) {
  return self.major == other.major && self.minor == other.minor;
}



https://github.com/llvm/llvm-project/pull/135068


More information about the llvm-commits mailing list