https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105985
Bug ID: 105985 Summary: The case of "indirectly" exported by the primary module interface unit is not accepted Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: xmh970252187 at gmail dot com Target Milestone: --- // translation unit C export module M :C; // translation unit U export module M :U; import :C; // translation unit T export module M; export import :U; // #1 [module.unit] says > All module partitions of a module that are module interface units shall be > directly or indirectly exported by the primary module interface unit > ([module.import]). No diagnostic is required for a violation of these rules. [module.import] p7 says > When a module-import-declaration imports a translation unit T, it also > imports all translation units imported by exported module-import-declarations > in T; such translation units are said to be exported by T. Additionally, when > a module-import-declaration in a module unit of some module M imports another > module unit U of M, it also imports all translation units imported by > non-exported module-import-declarations in the module unit purview of U. > These rules can in turn lead to the importation of yet more translation units. It is clear that "U" is exported by "T" since an exported module-import-declaration at #1 imports "U" in "T", which is exactly said in the first part of [module.import] p7. Since "T" and "U" are both module units of "M", the second part of [module.import] p7 should apply to the "module-import-declaration" at #1, since the "non-exported module-import-declaration"("import :C;") appears in U, the module-import-declaration at #1 should also import "C". So, "C" is arguably said that it is indirectly exported by "T". All partition module interface units of M are exported by the primary module interface unit of M. There is no violation here. However, If we compile the example through GCC, it reports an error that: > interface partition is not exported