https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100707
--- Comment #1 from wang ivor <amorvincitomnia.iw at gmail dot com> --- A quick workaround: https://wandbox.org/permlink/n8E5xJuJhq1CUA0e Create a module that only contains the namespace declaration, and 'export import' it whenever you declare a new namespace. // namespace_decl.cc export module namespace_decl; export namespace A::B{ } // m2.cc export module m2; export import namespace_decl; import m3; export namespace A::B{ }