https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101839
--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Thanks for looking into this. What happens here is that we start working from a call where we know that outer_type is BA. We correctly find the BA::type and notice that it is final and thus we do not need to look for sucessors to find something. However we later decide to discard it here: 3241 if (type_possibly_instantiated_p (outer_type->type)) 3244 skipped = true; This is trying to check, for anonymous types, the possibility that a given target is never going to be taken since type was never instantiated. It is true that BA is not instantiated however its successor is. So we need to keep track that we saw FINAL and in that case extend type_possibly_instantiated_p to also look for all derived types. This is quite ugly mistake I got in as the possibly_instantiated code was implemented before we got DECL_FINAl flag. I will prepare patch.