comparison clang/test/Modules/pr60890.cppm @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents
children
comparison
equal deleted inserted replaced
237:c80f45b162ad 252:1f2b6ac9f198
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 -S -emit-llvm -o -
11
12 //--- a.cppm
13 export module a;
14
15 export template<typename T>
16 struct a {
17 friend void aa(a x) requires(true) {}
18 void aaa() requires(true) {}
19 };
20
21 export template struct a<double>;
22
23 export template<typename T>
24 void foo(T) requires(true) {}
25
26 export template void foo<double>(double);
27
28 export template <typename T>
29 class A {
30 friend void foo<>(A);
31 };
32
33 //--- b.cppm
34 export module b;
35
36 import a;
37
38 void b() {
39 a<int> _;
40 a<double> __;
41 }
42
43 //--- c.cppm
44 export module c;
45
46 import a;
47
48 struct c {
49 void f() const {
50 a<int> _;
51 aa(_);
52 _.aaa();
53
54 a<double> __;
55 aa(__);
56 __.aaa();
57
58 foo<int>(5);
59 foo<double>(3.0);
60 foo(A<int>());
61 }
62 };
63
64 //--- d.cpp
65 // expected-no-diagnostics
66 import a;
67 import b;
68 import c;
69
70 void d() {
71 a<int> _;
72 aa(_);
73 _.aaa();
74
75 a<double> __;
76 aa(__);
77 __.aaa();
78
79 foo<int>(5);
80 foo<double>(3.0);
81 foo(A<int>());
82 }