The following two valid translation units
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
export module b;
import a;
namespace n {
auto b() -> void {
a() == a();
}
} // namespace n
causes clang to fail to compile with
In file included from /app/b.cpp:3:
a.cpp:10:47: error: invalid operands to binary expression ('monostate' and 'monostate')
10 | friend auto operator==(a, a) -> bool = default;
| ^
b.cpp:8:6: note: in defaulted equality comparison operator for 'a' first required here
8 | a() == a();
| ^
b.cpp:8:6: warning: equality comparison result unused [-Wunused-comparison]
8 | a() == a();
| ~~~~^~~~~~
1 warning and 1 error generated.
See it live: https://godbolt.org/z/TvWs7osPs
This is basically the same as #123815 except instead of qualifying the call site with the namespace of the outer type, we are calling from within the namespace. This feels somewhat similar to but not the same as #133720