1 // RUN: rm -fr %t 2 // RUN: mkdir %t 3 // RUN: split-file %s %t 4 // 5 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/foo.cppm -o %t/foo.pcm 6 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only 7 // 8 //--- foo.cppm 9 module; 10 # 3 __FILE__ 1 // use the next physical line number here (and below) 11 template <typename T> foo()12void foo() { 13 } 14 15 template <> foo()16void foo<int>() { 17 } 18 19 template <typename T> foo2()20void foo2() { 21 } 22 23 template <> foo2()24void foo2<int>() { 25 } 26 27 template <typename T> foo3()28void foo3() { 29 } 30 31 template <> 32 void foo3<int>(); 33 34 export module foo; 35 export using ::foo; 36 export using ::foo3; 37 38 export template <typename T> foo4()39void foo4() { 40 } 41 42 export template <> foo4()43void foo4<int>() { 44 } 45 46 //--- Use.cpp 47 import foo; use()48void use() { 49 foo<short>(); 50 foo<int>(); 51 foo2<short>(); // expected-error {{missing '#include'; 'foo2' must be declared before it is used}} 52 // expected-note@* {{declaration here is not visible}} 53 foo2<int>(); // expected-error {{missing '#include'; 'foo2' must be declared before it is used}} 54 // expected-note@* {{declaration here is not visible}} 55 foo3<short>(); 56 foo3<int>(); 57 58 foo4<short>(); 59 foo4<int>(); 60 } 61