https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105729
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the problem is that fold_unary optimizes conversion of (const struct Bar *) ((const struct Foo *) this)->data + (sizetype) range_check (x) to const struct Bar & type into conversion of the lhs of the POINTER_PLUS_EXPR to const struct Bar & type followed by POINTER_PLUS_EXPR.