Debian Codegraph @

clang/test/Modules/pr138558.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/a.cppm -emit-reduced-module-interface -o %t/test-A.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/N.cppm -emit-reduced-module-interface -o %t/test-N.pcm
7 // RUN: %clang_cc1 -std=c++20 %t/B.cppm -verify -fsyntax-only -fprebuilt-module-path=%t
8
9 //--- a.h
10 namespace N {
11 inline namespace impl {
12 template <typename>
13 class C {
14 template <typename> friend void foo();
15 };
16
17 template <typename> void foo() {}
18 } // namespace impl
19 } // namespace N
20
21 //--- a.cppm
22 // This is some unrelated file. It also #includes system headers, but
23 // here does not even export anything.
24 module;
25 #include "a.h"
26 export module test:A;
27 // To make sure they won't elided.
28 using N::C;
29 using N::foo;
30
31 //--- N.cppm
32 module;
33 #include "a.h"
34 export module test:N;
35
36 // Now wrap these names into a module and export them:
37 export {
38 namespace N {
39 inline namespace impl {
40 using N::impl::C;
41 using N::impl::foo;
42 }
43 }
44 }
45
46 //--- B.cppm
47 // expected-no-diagnostics
48 // A file that consumes the partitions from the other two files,
49 // including the exported N::C name.
50 module test:B;
51 import :N;
52 import :A;
53
54 N::C<int> x;