89 lines · plain
1// https://github.com/llvm/llvm-project/issues/608902//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a.pcm8// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cppm -fprebuilt-module-path=%t -o %t/b.pcm9// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cppm -fprebuilt-module-path=%t -o %t/c.pcm10// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -emit-llvm-only11 12// Test again with reduced BMI13// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a.cppm -o %t/a.pcm14// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/b.cppm -fprebuilt-module-path=%t -o %t/b.pcm15// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/c.cppm -fprebuilt-module-path=%t -o %t/c.pcm16// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -emit-llvm-only17 18//--- a.cppm19export 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.cppm40export module b;41 42import a;43 44void b() {45 a<int> _;46 a<double> __;47}48 49//--- c.cppm50export 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.cpp71// expected-no-diagnostics72import 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