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