[lld] Mark operator== const to avoid ambiguity in C++20. (PR #68119)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 08:42:03 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/68119.diff
1 Files Affected:
- (modified) lld/COFF/Config.h (+1-1)
``````````diff
diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h
index e66ab3a32c56721..ff87eab2744dd51 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 &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/68119
More information about the llvm-commits
mailing list