to address following error when compiling with C++20 standard:
../src/rgw/cls_fifo_legacy.cc:2217:22: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'rados::cls::fifo::journal_entry' and 'rados::cls::fifo::journal_entry') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
!(jiter->second == e)) {
~~~~~~~~~~~~~ ^ ~
../src/cls/fifo/cls_fifo_types.h:148:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
bool operator ==(const journal_entry& e) {
^
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
}
void dump(ceph::Formatter* f) const;
- bool operator ==(const journal_entry& e) {
- return (op == e.op &&
- part_num == e.part_num &&
- part_tag == e.part_tag);
+ friend bool operator ==(const journal_entry& lhs, const journal_entry& rhs) {
+ return (lhs.op == rhs.op &&
+ lhs.part_num == rhs.part_num &&
+ lhs.part_tag == rhs.part_tag);
}
};
WRITE_CLASS_ENCODER(journal_entry)