xref: /llvm-project/clang/test/Modules/module-local-hidden-friend-2.cppm (revision 378dcf61014b787b3542b917f6296c9fb5ec490c)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: cd %t
4//
5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
7// RUN:     -fmodule-file=a=%t/a.pcm
8// RUN: %clang_cc1 -std=c++20 %t/use.cc -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm \
9// RUN:     -fsyntax-only -verify
10//
11// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm
12// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm \
13// RUN:     -fmodule-file=a=%t/a.pcm
14// RUN: %clang_cc1 -std=c++20 %t/use.cc -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm \
15// RUN:     -fsyntax-only -verify
16
17//--- a.cppm
18export module a;
19
20namespace n {
21}
22
23//--- b.cppm
24export module b;
25import a;
26
27namespace n {
28struct monostate {
29	friend bool operator==(monostate, monostate) = default;
30};
31
32export struct wrapper {
33	friend bool operator==(wrapper const &, wrapper const &) = default;
34
35	monostate m_value;
36};
37}
38
39//--- use.cc
40// expected-no-diagnostics
41import b;
42
43static_assert(n::wrapper() == n::wrapper());
44