https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120125
--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> --- FWIW I have a WIP patch that fixes the ICE (also for the original testcase): diff --git a/gcc/cp/optimize.cc b/gcc/cp/optimize.cc index 6f9a77f407a..fc4d6c2e351 100644 --- a/gcc/cp/optimize.cc +++ b/gcc/cp/optimize.cc @@ -309,8 +309,8 @@ maybe_thunk_body (tree fn, bool force) defer_mangling_aliases = save_defer_mangling_aliases; cgraph_node::get_create (fns[0])->set_comdat_group (comdat_group); cgraph_node::get_create (fns[1])->add_to_same_comdat_group - (cgraph_node::get_create (fns[0])); - symtab_node::get (fn)->add_to_same_comdat_group + (cgraph_node::get (fns[0])); + symtab_node::get_create (fn)->add_to_same_comdat_group (symtab_node::get (fns[0])); if (fns[2]) /* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is though I think there's another bigger issue somewhere to do with how we've handled imported explicit instantiations of inline constructors with '-fdeclone-ctor-dtor', as the generated code doesn't look right to me. Maybe this patch would be sufficient for backporting to 14/15 though.