https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114795
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=114600, | |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=99000 CC| |nshead at gcc dot gnu.org --- Comment #3 from Nathaniel Shead <nshead at gcc dot gnu.org> --- Similarly to PR114600 (and PR99000 and maybe some others?) this is because we don't support textual redefinitions yet (`#include` after `import` naming the same things). See https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Modules.html: G++’s modules support is not complete. Other than bugs, the known missing pieces are: [...] Textual merging of reachable GM entities Entities may be multiply defined across different header-units. These must be de-duplicated, and this is implemented across imports, or when an import redefines a textually-defined entity. However the reverse is not implemented—textually redefining an entity that has been defined in an imported header-unit. A redefinition error is emitted. A workaround is to ensure that `#include` always goes before `import`, or to use a header module here rather than `#include`. FWIW this particular ICE is because we hit this assertion: /* Don't add decls after definition. */ gcc_assert (TYPE_BEING_DEFINED (current_class_type) /* We can add lambda types when late parsing default arguments. */ || LAMBDA_TYPE_P (TREE_TYPE (decl))); but the class has already been defined earlier, by the import. The other issue here is that we didn't discard the entire GMF here, I suppose possibly because of a similar issue as described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114630#c2.