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

Ivan Tadeu Ferreira Antunes Filho via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 13:42:52 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) {
----------------
itf wrote:

Is there a way to access VersionType without it being a method?  If we didn't depend on the template for the comparison, it would be simple. 

And without it being a friend, I'm unsure how to create a symmetric binary operator. Removing "friend" would cause it to have 3 parameters, and if we remove &self, we go back to the original issue we are trying to fix.

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


More information about the llvm-commits mailing list