[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:
Tony Allevato
2023-10-03 16:16:37 -04:00
parent cbf9694dd1
commit 5f5b24f96e
12 changed files with 18 additions and 18 deletions

View File

@@ -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;
}
};