https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98261
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This is undefined behavior. A and B are unrelated types. You cannot expect to call a virtual function of B via a pointer that is of type A.