https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80665
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- To clarify Richard's statement in the following statement is undefined Derived* snd_ptr = fst_ptr->as<Derived>(); When fst_ptr is a null pointer.