1// https://github.com/llvm/llvm-project/issues/60890 2// 3// RUN: rm -rf %t 4// RUN: mkdir -p %t 5// RUN: split-file %s %t 6// 7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a.pcm 8// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cppm -fprebuilt-module-path=%t -o %t/b.pcm 9// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cppm -fprebuilt-module-path=%t -o %t/c.pcm 10// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -emit-llvm-only 11 12// Test again with reduced BMI 13// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a.cppm -o %t/a.pcm 14// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/b.cppm -fprebuilt-module-path=%t -o %t/b.pcm 15// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/c.cppm -fprebuilt-module-path=%t -o %t/c.pcm 16// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -emit-llvm-only 17 18//--- a.cppm 19export module a; 20 21export template<typename T> 22struct a { 23 friend void aa(a x) requires(true) {} 24 void aaa() requires(true) {} 25}; 26 27export template struct a<double>; 28 29export template<typename T> 30void foo(T) requires(true) {} 31 32export template void foo<double>(double); 33 34export template <typename T> 35class A { 36 friend void foo<>(A); 37}; 38 39//--- b.cppm 40export module b; 41 42import a; 43 44void b() { 45 a<int> _; 46 a<double> __; 47} 48 49//--- c.cppm 50export module c; 51 52import a; 53 54struct c { 55 void f() const { 56 a<int> _; 57 aa(_); 58 _.aaa(); 59 60 a<double> __; 61 aa(__); 62 __.aaa(); 63 64 foo<int>(5); 65 foo<double>(3.0); 66 foo(A<int>()); 67 } 68}; 69 70//--- d.cpp 71// expected-no-diagnostics 72import a; 73import b; 74import c; 75 76void d() { 77 a<int> _; 78 aa(_); 79 _.aaa(); 80 81 a<double> __; 82 aa(__); 83 __.aaa(); 84 85 foo<int>(5); 86 foo<double>(3.0); 87 foo(A<int>()); 88} 89