mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[C++20] Make operator{==,!=}s const.
In C++20, the compiler will synthesize a version of the operator with its arguments reversed to ease commutativity. This reversed version is ambiguous with the hand-written operator when the argument is const but `this` isn't.
This commit is contained in:
@@ -46,7 +46,7 @@ struct SerializedSourceLoc {
|
||||
unsigned FileID = 0;
|
||||
unsigned Offset = 0;
|
||||
|
||||
bool operator==(const SerializedSourceLoc &RHS) {
|
||||
bool operator==(const SerializedSourceLoc &RHS) const {
|
||||
return FileID == RHS.FileID && Offset == RHS.Offset;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user