Debian Codegraph @

clang/test/Modules/pr71484.cppm

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 %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 }