https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111284
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Actually, the binding of parms seems to work fine. But am out of ideas where this should be fixed. When evaluating the comparison, we have lhs (const struct S *) (struct S *) ((const struct S *) this)->s and rhs (const struct S *) this and we constant evaluate both. In both cases we find this (foo's artificial argument in #c2) is &x where x is bar's PARM_DECL. But in the lhs case, -> is applied to it, so x is evaluated as prvalue as {.s=&D.2836} where D.2836 is the local temp built for AGGR_INIT_EXPR - but nothing during the constexpr evaluation actually knows that &D.2836 is actually the address of the x argument. So, lhs folds into &D.2836 with some cast. While then constexpr evaluating rhs sees just accessing this which is &x and in that case x is used as an lvalue, so the folds into &x. And those two are not equal. So, I think we need to treat somewhere the arguments (and return values?) with TREE_ADDRESSABLE types during constexpr evaluations actually as references rather than what they are in the source (so what we do after genericization).