xref: /llvm-project/clang/test/Modules/pr61065.cppm (revision da00c60dae0040185dc45039c4397f6e746548e9)
1// From https://github.com/llvm/llvm-project/issues/61065
2// RUN: rm -rf %t
3// RUN: mkdir -p %t
4// RUN: split-file %s %t
5//
6// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
7// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
8// RUN:     -fprebuilt-module-path=%t
9// DISABLED: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \
10// DISABLED:     -fprebuilt-module-path=%t
11// DISABLED: %clang_cc1 -std=c++20 %t/d.cpp -fsyntax-only -verify -fprebuilt-module-path=%t
12
13// Test again with reduced BMI
14// RUN: rm -rf %t
15// RUN: mkdir -p %t
16// RUN: split-file %s %t
17//
18// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm
19// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm \
20// RUN:     -fprebuilt-module-path=%t
21// DISABLED: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -o %t/c.pcm \
22// DISABLED:     -fprebuilt-module-path=%t
23// DISABLED: %clang_cc1 -std=c++20 %t/d.cpp -fsyntax-only -verify -fprebuilt-module-path=%t
24
25
26//--- a.cppm
27export module a;
28
29struct base {
30	base(int) {}
31};
32
33export struct a : base {
34	using base::base;
35};
36
37//--- b.cppm
38export module b;
39
40import a;
41
42a b() {
43	return a(1);
44}
45
46//--- c.cppm
47export module c;
48
49import a;
50import b;
51
52struct noncopyable {
53	noncopyable(noncopyable const &) = delete;
54    noncopyable() = default;
55};
56
57export struct c {
58	noncopyable c0;
59	a c1 = 43;
60    c() = default;
61};
62
63//--- d.cpp
64// expected-no-diagnostics
65import c;
66void d() {
67    c _;
68}
69