[lld] Mark operator== const to avoid ambiguity in C++20. (PR #68119)
Samira Bazuzi via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 08:40:22 PDT 2023
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/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.
>From 4667528ee8f997ce62d83d916064f12b296bab0d Mon Sep 17 00:00:00 2001
From: Samira Bazuzi <bazuzi at google.com>
Date: Tue, 3 Oct 2023 11:37:10 -0400
Subject: [PATCH] Mark operator== const to avoid ambiguity in C++20.
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.
---
lld/COFF/Config.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 &&
More information about the llvm-commits
mailing list