ir: Support comparing a class_decl against a class_or_union

When a class_decl is compared against a class_or_union type using
class_decl::operator==, that operator systematically fails.  This
patch fixes that by comparing the common parts between the two
objects.

	* src/abg-ir.cc (class_decl::operator==): Support comparing
	against a class_or_union.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2024-08-05 17:47:01 +02:00
parent 0284239bb1
commit d1bba71063

View File

@ -25647,7 +25647,11 @@ class_decl::operator==(const decl_base& other) const
{
const class_decl* op = is_class_type(&other);
if (!op)
return false;
{
if (class_or_union* cou = is_class_or_union_type(&other))
return class_or_union::operator==(*cou);
return false;
}
// If this is a decl-only type (and thus with no canonical type),
// use the canonical type of the definition, if any.