https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123738
--- Comment #10 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:c6dd51c062667fdf2db3bed0ab50e034e048f3b5 commit r16-7393-gc6dd51c062667fdf2db3bed0ab50e034e048f3b5 Author: Nathaniel Shead <[email protected]> Date: Sat Jan 31 21:45:39 2026 +1100 c++/modules: Fix ICE with multiple module declarations and -M [PR123738] When only doing preprocessing, we do not call declare_module, and so we do not check that a module has been declared multiple times. This means we end up with multiple "primary modules" being passed to the dependency producing logic, which asserts. Fixed by checking if we've already seen a module declaration and complaining. PR c++/123738 gcc/cp/ChangeLog: * module.cc (preprocess_module): Complain for any non-imported module declaration in a module purview. gcc/testsuite/ChangeLog: * g++.dg/modules/dep-5.C: New test. Signed-off-by: Nathaniel Shead <[email protected]> Reviewed-by: Jason Merrill <[email protected]>
