Debian Codegraph @

clang/test/Modules/pr63595.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 -emit-module-interface -I%t %t/module1.cppm -o %t/module1.pcm
6 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/module2.cppm -o %t/module2.pcm
7 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/merge.cpp -verify -fsyntax-only
8
9 // Test again with reduced BMI.
10 // RUN: rm -rf %t
11 // RUN: mkdir %t
12 // RUN: split-file %s %t
13 //
14 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface -I%t %t/module1.cppm -o %t/module1.pcm
15 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface -I%t %t/module2.cppm -o %t/module2.pcm
16 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/merge.cpp -verify -fsyntax-only
17
18
19 //--- header.h
20 namespace NS {
21 template <int I>
22 class A {
23 };
24
25 template <template <int I_> class T>
26 class B {
27 };
28 }
29
30 //--- module1.h
31 namespace NS {
32 using C = B<A>;
33 }
34 struct D : NS::C {
35 using Type = NS::C;
36 };
37
38 //--- module1.cppm
39 // inside NS, using C = B<A>
40 module;
41 #include "header.h"
42 #include "module1.h"
43 export module module1;
44 export using ::D;
45
46 //--- module2.h
47 namespace NS {
48 using C = B<NS::A>;
49 }
50 struct D : NS::C {
51 using Type = NS::C;
52 };
53
54 //--- module2.cppm
55 // inside NS, using C = B<NS::A>
56 module;
57 #include "header.h"
58 #include "module2.h"
59 export module module2;
60 export using ::D;
61
62 //--- merge.cpp
63 // expected-no-diagnostics
64 import module1;
65 import module2;
66 D d;