1 // RUN: rm -rf %t 2 // RUN: mkdir -p %t 3 // RUN: split-file %s %t 4 // 5 // RUN: %clang_cc1 -std=c++20 %t/X.cppm -emit-module-interface -o %t/X.pcm 6 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify 7 // 8 // RUN: %clang_cc1 -std=c++20 %t/X.cppm -emit-reduced-module-interface -o %t/X.pcm 9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify 10 // 11 //--- foo.h 12 #ifndef FOO_H 13 #define FOO_H 14 template <typename T> 15 struct base {}; 16 17 template <typename T> 18 struct foo; 19 20 template <typename T> 21 struct foo {}; 22 23 template <> 24 struct foo<int> : base<int> { 25 int getInt(); 26 }; 27 #endif // FOO_H 28 29 //--- X.cppm 30 module; 31 #include "foo.h" 32 export module X; 33 export template <class T> 34 class X { 35 foo<int> x; 36 37 public: print()38 int print() { 39 return x.getInt(); 40 } 41 }; 42 43 //--- Use.cpp 44 import X; 45 foo<int> f; // expected-error {{'foo' must be declared before it is used}} 46 // expected-note@* {{declaration here is not visible}} bar()47int bar() { 48 X<int> x; 49 return x.print(); 50 } 51