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