https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120183
Bug ID: 120183 Summary: Incomplete type error in module import Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rafel.perello at upc dot edu Target Milestone: --- Created attachment 61375 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61375&action=edit Code and makefile // module.cpp export module mod; export import <array>; export template<int a, std::array<int, (a == -1) ? 0 : a> b> class A {}; template<int a, std::array<int, (a == -1) ? 0 : a> b> requires(a == -1) class A<a, b> {}; template<int a, std::array<int, (a == -1) ? 0 : a> b> requires(a != -1) class A<a, b> : public A<-1, std::array<int, 0>{}> {}; // main.cpp import mod; #ifdef DEFINE_B template<int a, std::array<int, (a == -1) ? 0 : a> b> class B {}; template<int a, std::array<int, (a == -1) ? 0 : a> b> requires(a == -1) class B<a, b> {}; template<int a, std::array<int, (a == -1) ? 0 : a> b> requires(a != -1) class B<a, b> : public B<-1, std::array<int, 0>{}> {}; #endif int main() { A<0, std::array<int, 0>{}> a{}; #ifdef DEFINE_B B<0, std::array<int, 0>{}> b{}; #endif } The above code does not compile on g++ 15.1.0 running the following commands: g++ -std=c++26 -fmodules-ts -xc++-system-header array g++ -std=c++26 -fmodules-ts module.cpp -c g++ -std=c++26 -fmodules-ts main.cpp -o main It complains about A having incomplete type. However, it compiles if the last command is substituted by g++ -std=c++26 -fmodules-ts main.cpp -o main -DDEFINE_B That is, the class B is defined in the same exact way than A but in the main file. In this case, both uses of the classes are valid.