-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[LLD][COFF] Mark operator== const to avoid ambiguity in C++20. #68119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@llvm/pr-subscribers-platform-windows @llvm/pr-subscribers-lld ChangesC++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:
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 &&
|
@mstorsjo I don't have write access, so can't specifically add reviewers, but I see that you reviewed the last change touching this file. Would you be able to take a look at this small change? |
You mean when building LLD with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reproduced the issue, thanks for the fix! LGTM. I can merge the change if there are no further objections from @mstorsjo
Thanks! |
No objection from me, this seems straightforward to me. Thanks for the patch, and thanks for reviewing it! |
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.