Skip to content

Commit 10ad98d

Browse files
committed
[NFC] [C++20] [Modules] Add a test from issue 71484
The example from issue report 71484 works fine on trunk. Add the example to the tests since testing is always good.
1 parent f8986df commit 10ad98d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

clang/test/Modules/pr71484.cppm

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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/mod1.cppm -emit-module-interface -o %t/mod1.pcm
6+
// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-module-interface -o %t/mod2.pcm \
7+
// RUN: -fprebuilt-module-path=%t
8+
// RUN: %clang_cc1 -std=c++20 %t/mod3.cppm -fsyntax-only -verify \
9+
// RUN: -fprebuilt-module-path=%t
10+
11+
// RUN: %clang_cc1 -std=c++20 %t/mod1.cppm -emit-obj -o %t/mod1.o -fmodule-output=%t/mod1.pcm
12+
// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-obj -o %t/mod2.o -fmodule-output=%t/mod2.pcm \
13+
// RUN: -fprebuilt-module-path=%t
14+
// RUN: %clang_cc1 -std=c++20 %t/mod3.cppm -fsyntax-only -verify \
15+
// RUN: -fprebuilt-module-path=%t
16+
17+
//--- mod1.cppm
18+
export module mod1;
19+
20+
export template<class T>
21+
T mod1_f(T x) {
22+
return x;
23+
}
24+
25+
//--- mod2.cppm
26+
export module mod2;
27+
import mod1;
28+
29+
export template<class U>
30+
U mod2_g(U y) {
31+
return mod1_f(y);
32+
}
33+
34+
//--- mod3.cppm
35+
// expected-no-diagnostics
36+
export module mod3;
37+
import mod2;
38+
39+
export int mod3_h(int p) {
40+
return mod2_g(p);
41+
}

0 commit comments

Comments
 (0)