Commit 1fe4edb2 authored by Peter Kasting's avatar Peter Kasting Committed by V8 LUCI CQ

operator==() must use the same type on both sides.

This fixes a compile error in C++20 with comparison operator reordering.

Also does a little misc. cleanup to the adjacent code.

Bug: chromium:1284275
Change-Id: I1999c4ef2e8a201d2f1270347fe12c33c961c011
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3830987
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82497}
parent d0cd940f
......@@ -410,14 +410,13 @@ struct OperationT : Operation {
this->inputs().OverwriteWith(inputs);
}
bool operator==(const Derived& other) const {
const Derived& derived = *static_cast<const Derived*>(this);
return derived.inputs() == other.inputs() &&
derived.options() == other.options();
bool operator==(const Base& other) const {
return derived_this().inputs() == other.derived_this().inputs() &&
derived_this().options() == other.derived_this().options();
}
size_t hash_value() const {
const Derived& derived = *static_cast<const Derived*>(this);
return base::hash_combine(opcode, derived.inputs(), derived.options());
return base::hash_combine(opcode, derived_this().inputs(),
derived_this().options());
}
void PrintOptions(std::ostream& os) const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment