[lld] 8899b71 - [LLD][COFF] Mark operator== const to avoid ambiguity in C++20. (#68119)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 08:39:27 PDT 2023


Author: Samira Bazuzi
Date: 2023-10-04T11:39:20-04:00
New Revision: 8899b713ea65f038d29043d5801283d2a79d4ed4

URL: https://github.com/llvm/llvm-project/commit/8899b713ea65f038d29043d5801283d2a79d4ed4
DIFF: https://github.com/llvm/llvm-project/commit/8899b713ea65f038d29043d5801283d2a79d4ed4.diff

LOG: [LLD][COFF] Mark operator== const to avoid ambiguity in C++20. (#68119)

C++20 will automatically generate an operator== with reversed operand
order, which is ambiguous with the written operator== when one argument
is marked const and the other isn't.

Added: 
    

Modified: 
    lld/COFF/Config.h

Removed: 
    


################################################################################
diff  --git a/lld/COFF/Config.h b/lld/COFF/Config.h
index 562af7e0d23c19f..da31818be23dc1e 100644
--- a/lld/COFF/Config.h
+++ b/lld/COFF/Config.h
@@ -72,7 +72,7 @@ struct Export {
   StringRef symbolName;
   StringRef exportName; // Name in DLL
 
-  bool operator==(const Export &e) {
+  bool operator==(const Export &e) const {
     return (name == e.name && extName == e.extName &&
             aliasTarget == e.aliasTarget &&
             ordinal == e.ordinal && noname == e.noname &&


        


More information about the llvm-commits mailing list