https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122636
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <[email protected]>: https://gcc.gnu.org/g:fac9e25d6d0b72220c12c424363b76e782f34779 commit r16-5523-gfac9e25d6d0b72220c12c424363b76e782f34779 Author: Nathaniel Shead <[email protected]> Date: Sun Nov 23 00:06:06 2025 +1100 c++/modules: Fix -Wexpose-global-module-tu-local [PR122636] I had mistakenly been checking the importedness of the originating module decl, but this is wrong: really we want to check if the specific decl we're currently instantating came from another module, so just check DECL_MODULE_IMPORT_P on this directly. Also updated slightly since there are cases where we do emit TU-local function or variable templates, albeit unlikely to come up frequently. PR c++/122636 gcc/cp/ChangeLog: * module.cc (instantiating_tu_local_entity): Don't check importingness of originating module decl; also check templates. gcc/testsuite/ChangeLog: * g++.dg/modules/internal-19_a.C: New test. * g++.dg/modules/internal-19_b.C: New test. Signed-off-by: Nathaniel Shead <[email protected]> Reviewed-by: Jason Merrill <[email protected]>
