Debian Codegraph @

clang/test/Modules/pr56916.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/M-A.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-module-interface -o %t/M-B.pcm
7 // RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-module-interface -o %t/M.pcm \
8 // RUN: -fprebuilt-module-path=%t
9 // RUN: %clang_cc1 -std=c++20 %t/Use.cpp -fsyntax-only -fprebuilt-module-path=%t -verify
10
11 // Test again with reduced BMI.
12 // RUN: rm -rf %t
13 // RUN: mkdir %t
14 // RUN: split-file %s %t
15 //
16 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/M-A.pcm
17 // RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-reduced-module-interface -o %t/M-B.pcm
18 // RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-reduced-module-interface -o %t/M.pcm \
19 // RUN: -fprebuilt-module-path=%t
20 // RUN: %clang_cc1 -std=c++20 %t/Use.cpp -fsyntax-only -fprebuilt-module-path=%t -verify
21
22
23 //--- foo.h
24 template <typename T>
25 class Templ {
26 public:
27 Templ(T a) {}
28 };
29
30 //--- A.cppm
31 module;
32 #include "foo.h"
33 export module M:A;
34 export using ::Templ;
35
36 //--- B.cppm
37 module;
38 #include "foo.h"
39 export module M:B;
40
41 //--- M.cppm
42 export module M;
43 export import :A;
44 export import :B;
45
46 //--- Use.cpp
47 // expected-no-diagnostics
48 import M;
49
50 void func() {
51 Templ t(5);
52 }