https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114630

--- Comment #5 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
I've been testing a patch series that tries to solve this from the other end
(by remembering whether we were in the module purview when we deferred the
instantiation and restoring that state within reopen_tinst_level, similarly to
how e.g. input_location is handled for error messages).

AFAICT, DECL_MODULE_PURVIEW_P on template instantiations should only matter for
determining whether it might be discarded (i.e. applying DB_UNREACHED_BIT);
otherwise, in general purviewness and attachment should be determined by the
base template, as implemented in 'get_originating_module_decl'.

That said, my version doesn't actually solve the underlying issue: my
adjustment of your testcase to put instantiations into the module purview (and
force emission there) still gives the same error for me.  So it sounds like
there's something else being affected by DECL_MODULE_PURVIEW_P being set when
maybe it shouldn't for an explicit specialisation.

Reply via email to