https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100617
Paul Scharnofske <asynts+bugs at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |asynts+bugs at gmail dot com --- Comment #2 from Paul Scharnofske <asynts+bugs at gmail dot com> --- I ran into the same issue and produced a slightly different example: ```c++ // foo.cpp export module foo; import bar; namespace foo { export void foo() { } } ``` ```c++ // bar.cpp export module bar; namespace foo { } ``` ```c++ // baz.cpp export module baz; import foo; import bar; int main() { foo::foo(); } ``` ```none $ ~/.local/lib/gcc-trunk/bin/g++ --version g++ (GCC) 12.0.1 20220211 (experimental) Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ~/.local/lib/gcc-trunk/bin/g++ -Wall -Wextra -std=c++20 -fmodules-ts bar.cpp foo.cpp baz.cpp baz.cpp: In function 'int main()': baz.cpp:8:5: error: 'foo' has not been declared 8 | foo::foo(); | ^~~ baz.cpp: At global scope: baz.cpp:2:8: warning: not writing module 'baz' due to errors 2 | export module baz; | ^~~~~~ ``` https://godbolt.org/z/8zMaq6eqr - In other words, the 'export' specifier doesn't even have to be mentioned. It is enough if the same namespace is mentioned even if it is completely empty and not exported. - The issue disappears if the 'import bar' is removed from 'foo.cpp', in other words, this only happens if that module is actually imported. It doesn't matter that it's still imported in 'baz.cpp'.