https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109571
--- Comment #3 from Frank Heckenbach <f.heckenb...@fh-soft.de> --- Thanks for the explanation, that was really helpful. If I understand it correctly, since B has a vtable and A doesn't, upcasting means to add some offset to the pointer, but of course not if it's null. That's why null has to be special-cased which leads to the warning in one branch. (Since the compiler can't see that I won't actually put any null pointers there.) Now I know what to watch out for if I get more such warnings.