Debian Codegraph @

clang/test/Modules/pr120277-2.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4
5 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \
6 // RUN: -o %t/hu-01.pcm
7
8 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-02.h \
9 // RUN: -Wno-experimental-header-units -fmodule-file=%t/hu-01.pcm -o %t/hu-02.pcm
10
11 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-03.h \
12 // RUN: -Wno-experimental-header-units \
13 // RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm
14
15 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-04.h \
16 // RUN: -Wno-experimental-header-units -fmodule-file=%t/hu-02.pcm \
17 // RUN: -fmodule-file=%t/hu-03.pcm -o %t/hu-04.pcm
18
19 // RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
20 // RUN: -Wno-experimental-header-units -fmodule-file=%t/hu-04.pcm
21 //--- hu-01.h
22 template <typename T>
23 struct A {
24 ~A() { f(); }
25 auto f() const { return 0; }
26 };
27
28 template <typename T>
29 struct B {
30 int g() const { return a.f(); }
31 A<T> a;
32 };
33
34 //--- hu-02.h
35 import "hu-01.h";
36
37 template <typename = void>
38 struct C {
39 void h() {
40 B<int>().g();
41 }
42 };
43
44 template struct A<double>;
45
46 //--- hu-03.h
47 import "hu-01.h";
48
49 inline B<int> b() {
50 return {};
51 }
52
53 //--- hu-04.h
54 import "hu-02.h";
55 import "hu-03.h";
56
57 inline void f4() {
58 C{}.h();
59 }
60
61 //--- main.cpp
62 import "hu-04.h";
63
64 int main() {
65 f4();
66 }