https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98712
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-01-19 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |ppalka at gcc dot gnu.org --- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- Confirmed. It seems that when operator== is declared constexpr, we synthesize it eagerly from check_bases_and_members before doing layout_class_type, which means that at the point of synthesis the type's TYPE_FIELDS lacks the FIELD_DECLs that correspond to its bases, so build_comparison_op ends up completely ignoring the type's bases. When operator== is not declared constexpr, we synthesize the method lazily at the point of first use, and thus well after layout_class_type has been done from finish_struct_1.