xref: /llvm-project/clang/test/Modules/inconsistent-export.cppm (revision da00c60dae0040185dc45039c4397f6e746548e9)
1// RUN: rm -fr %t
2// RUN: mkdir %t
3// RUN: split-file %s %t
4//
5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/m-a.pcm
6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/m-b.pcm \
7// RUN:     -fprebuilt-module-path=%t
8// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-module-interface -o %t/m.pcm \
9// RUN:     -fprebuilt-module-path=%t
10// RUN: %clang_cc1 -std=c++20 %t/use.cppm -fprebuilt-module-path=%t -emit-obj
11
12// Test again with reduced BMI.
13// RUN: rm -fr %t
14// RUN: mkdir %t
15// RUN: split-file %s %t
16//
17// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/m-a.pcm
18// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/m-b.pcm \
19// RUN:     -fprebuilt-module-path=%t
20// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm \
21// RUN:     -fprebuilt-module-path=%t
22// RUN: %clang_cc1 -std=c++20 %t/use.cppm -fprebuilt-module-path=%t -emit-obj
23
24
25//--- a.cppm
26export module m:a;
27namespace n {
28export class a {
29public:
30    virtual ~a() {}
31};
32}
33
34//--- b.cppm
35export module m:b;
36namespace n {
37class a;
38}
39
40//--- m.cppm
41export module m;
42export import :a;
43export import :b;
44
45//--- use.cppm
46// expected-no-diagnostics
47export module u;
48export import m;
49
50struct aa : public n::a {
51    aa() {}
52};
53auto foo(n::a*) {
54    return;
55}
56
57void use() {
58    n::a _;
59}
60