xref: /llvm-project/clang/test/Modules/pr120277.cppm (revision 4b35dd57b88a59b169c3471cbc398113d3bf98e8)
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/a.cppm -emit-module-interface -o %t/a.pcm
6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
7// RUN:     -fprebuilt-module-path=%t
8// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \
9// RUN:     -fprebuilt-module-path=%t
10// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -o %t/d.pcm \
11// RUN:     -fprebuilt-module-path=%t
12// RUN: %clang_cc1 -std=c++20 %t/d.pcm -emit-llvm -o %t/d.ll \
13// RUN:     -fprebuilt-module-path=%t
14// RUN: cat %t/d.ll | FileCheck %t/d.cppm
15
16//--- a.cppm
17export module a;
18
19export template<int>
20struct a {
21	static auto f() {
22	}
23};
24
25//--- b.cppm
26export module b;
27
28import a;
29
30void b() {
31	a<0> t;
32}
33
34//--- c.cppm
35export module c;
36
37import a;
38
39void c() {
40	a<0>::f();
41}
42
43//--- d.cppm
44export module d;
45
46import a;
47import b;
48import c;
49
50struct d {
51	static void g() {
52		a<0>::f();
53		a<1>::f();
54	}
55};
56
57// fine enough to check it won't crash
58// CHECK: define
59