Debian Codegraph @

clang/test/Modules/pr60890.cppm

raw
1 // https://github.com/llvm/llvm-project/issues/60890
2 //
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t
5 // RUN: split-file %s %t
6 //
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a.pcm
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cppm -fprebuilt-module-path=%t -o %t/b.pcm
9 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cppm -fprebuilt-module-path=%t -o %t/c.pcm
10 // RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -emit-llvm-only
11
12 // Test again with reduced BMI
13 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a.cppm -o %t/a.pcm
14 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/b.cppm -fprebuilt-module-path=%t -o %t/b.pcm
15 // RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/c.cppm -fprebuilt-module-path=%t -o %t/c.pcm
16 // RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -emit-llvm-only
17
18 //--- a.cppm
19 export module a;
20
21 export template<typename T>
22 struct a {
23 friend void aa(a x) requires(true) {}
24 void aaa() requires(true) {}
25 };
26
27 export template struct a<double>;
28
29 export template<typename T>
30 void foo(T) requires(true) {}
31
32 export template void foo<double>(double);
33
34 export template <typename T>
35 class A {
36 friend void foo<>(A);
37 };
38
39 //--- b.cppm
40 export module b;
41
42 import a;
43
44 void b() {
45 a<int> _;
46 a<double> __;
47 }
48
49 //--- c.cppm
50 export module c;
51
52 import a;
53
54 struct c {
55 void f() const {
56 a<int> _;
57 aa(_);
58 _.aaa();
59
60 a<double> __;
61 aa(__);
62 __.aaa();
63
64 foo<int>(5);
65 foo<double>(3.0);
66 foo(A<int>());
67 }
68 };
69
70 //--- d.cpp
71 // expected-no-diagnostics
72 import a;
73 import b;
74 import c;
75
76 void d() {
77 a<int> _;
78 aa(_);
79 _.aaa();
80
81 a<double> __;
82 aa(__);
83 __.aaa();
84
85 foo<int>(5);
86 foo<double>(3.0);
87 foo(A<int>());
88 }