https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62051
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #5) > I suppose we could make C++ FE to track if a type has methods with > visibility default declared (I can't track that from symbol table as they > may be unreachable). In such case we may want to consider methods of that > type with non-default visibility and no resolution info to be > !can_refer_decl_in_current_unit_p > > Jason, would that make sense to you? Yes, though I think for such a class we probably want to consider all virtual methods unreachable unless they have explicit default visibility; in the testcase the main program isn't being compiled with -fvisibility=hidden, so ~Derived has implicit default visibility.