https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105227
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-04-11 Priority|P3 |P1 Component|c++ |tree-optimization CC| |jason at gcc dot gnu.org --- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> --- Confirmed. The problem seems to be that free_lang_data_in_decl changes DECL_CONTEXT of Klass::implementation to be the global scope because it isn't virtual, but eventually update_vtable_references changes the vtable entry for Klass::magic to refer to (a local alias for) Klass::implementation, so maybe_record_node's attempts to ask about its class context fail. Currently free_lang_data_in_decl works around this issue for destructors specifically, but not for other member functions. Not sure if the component should be tree-optimization or lto, but it isn't a front-end issue.