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

Walter Lee via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 15:47:30 PDT 2025


================
@@ -37,16 +37,18 @@ struct VersionBase {
 
   VersionBase(u16 major, u16 minor) : major(major), minor(minor) {}
 
-  bool operator==(const VersionType &other) const {
-    return major == other.major && minor == other.minor;
-  }
   bool operator>=(const VersionType &other) const {
     return major > other.major ||
            (major == other.major && minor >= other.minor);
   }
   bool operator<(const VersionType &other) const { return !(*this >= other); }
 };
 
+template <typename VersionType>
----------------
googlewalt wrote:

> I see you replied to first one, which is wrong.
> 
> However this one should work. I'll try locally
> 
> ```
> template <typename VersionType>
> bool operator==(const VersionBase<VersionType> &self, const VersionBase<VersionType> &other) {
>   return self.major == other.major && self.minor == other.minor;
> }
> ```

Yeah that seems to work.


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


More information about the llvm-commits mailing list