https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115801
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-invalid-code --- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> --- On looking further into it I believe this is ice-on-invalid. By https://eel.is/c++draft/temp.friend#2, within main.cpp the name ::Foo is looked up as if the specialisation had been explicitly declared at its point of instantiation. https://eel.is/c++draft/dcl.meaning.general#2.2.2 then requires that ::Foo corresponds to a declaration found by name lookup, which is not the case here (since Foo is not exported). In general I now believe that my previous fixes for temploid friend issues do not adequately handle name lookup correctly so should probably revisit that.