https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104934
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- And the bug is? The S class doesn't have the key method defined, so some other TU needs to define it and thus provide the vtable and rtti for it. Without -fsanitize=vptr the typeinfo isn't needed on this particular testcase and the vtable isn't needed either, which is why you don't get an undefined symbol in that case and you get it with -fsanitize=vptr or -fsanitize=undefined that implies that.