Close https://github.com/llvm/llvm-project/issues/159424 Close https://github.com/llvm/llvm-project/issues/133720 For in-class friend declaration, it is hard for the serializer to decide if they are visible to other modules. But luckily, Sema can handle it perfectly enough. So it is fine to make all of the in-class friend declaration as generally visible in ASTWriter and let the Sema to make the final call. This is safe as long as the corresponding class's visibility are correct.
37 lines
622 B
C++
37 lines
622 B
C++
// 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/a.pcm
|
|
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
|
|
|
|
//--- a.cppm
|
|
export module a;
|
|
|
|
namespace n {
|
|
|
|
struct monostate {
|
|
friend auto operator==(monostate, monostate) -> bool = default;
|
|
};
|
|
|
|
export struct a {
|
|
friend auto operator==(a, a) -> bool = default;
|
|
monostate m;
|
|
};
|
|
|
|
} // namespace n
|
|
|
|
//--- b.cppm
|
|
// expected-no-diagnostics
|
|
export module b;
|
|
|
|
import a;
|
|
|
|
namespace n {
|
|
|
|
export auto b() -> bool {
|
|
return a() == a();
|
|
}
|
|
|
|
} // namespace n
|