https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78873
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Ambroz Bizjak from comment #0) > But I think it is not valid; the result of the reinterpret_cast does not > point to a Liar object, so the static_cast done in TestDevirtualuzation > *should* be invalid. I couldn't find a clear statement in the standard about > this though. I don't think the implicit derived-to-base conversion sequence (which the static_cast performs explicitly) does require the object to really point to a Liar. The inverse static_cast, casting Iface* to Liar*, would be invalid if it doesn't point to a Liar. So on that basis, GCC is correct not to devirtualize in TestDevirtualuzation. The Intel compiler also does an indirect call there. Clang calls Impl::foo() directly though.