Skip to content

Commit 832f6dc

Browse files
committed
[C++20][Modules][Serialization] Add an additional test case for #120277.
4b35dd5 was shipped to address #120277 . It was thought to be a regression in 19.x according to this comment: #120277 (comment) This is a test case that fails even in 17.x but nevertheless is also fixed by: 4b35dd5 .
1 parent 9d5edc9 commit 832f6dc

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

clang/test/Modules/pr120277-2.cpp

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

0 commit comments

Comments
 (0)