xref: /llvm-project/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.export/p1.cppm (revision d54888a3ebb141cdbb5e88ed7a3a2a54d24fc904)
1// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: split-file %s %t
4//
5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a.pcm
6// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cppm -o %t/b.pcm
7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cppm -o %t/c.pcm
8//
9// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -emit-module-interface %t/aggregate.internal.cppm -o %t/aggregate.internal.pcm
10// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -emit-module-interface %t/aggregate.cppm -o %t/aggregate.pcm
11//
12// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/use.cpp -verify -DTEST
13
14
15//--- a.cppm
16export module a;
17export class A{};
18
19//--- b.cppm
20export module b;
21export class B{};
22
23//--- c.cppm
24export module c;
25export class C{};
26
27//--- aggregate.internal.cppm
28export module aggregate.internal;
29export import a;
30export import b;
31export import c;
32
33//--- aggregate.cppm
34// Export the above aggregate module.
35// This is done to ensure that re-exports are transitive.
36export module aggregate;
37export import aggregate.internal;
38
39
40//--- use.cpp
41// expected-no-diagnostics
42// For the actual test, just try using the classes from the exported modules
43// and hope that they're accessible.
44import aggregate;
45A a;
46B b;
47C c;
48