// RUN: rm -rf %t // RUN: mkdir -p %t // RUN: split-file %s %t // // RUN: %clang_cc1 -std=c++20 %t/X.cppm -emit-module-interface -o %t/X.pcm // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify // //--- foo.h #ifndef FOO_H #define FOO_H template struct base {}; template struct foo; template struct foo {}; template <> struct foo : base { int getInt(); }; #endif // FOO_H //--- X.cppm module; #include "foo.h" export module X; export template class X { foo x; public: int print() { return x.getInt(); } }; //--- Use.cpp import X; foo f; // expected-error {{'foo' must be declared before it is used}} // expected-note@* {{declaration here is not visible}} int bar() { X x; return x.print(); }