<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123815>123815</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[c++][Modules] Member variable of non-exported type has inaccessible hidden friend with defaulted comparison
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidstone
</td>
</tr>
</table>
<pre>
The following valid translation units
```c++
export module a;
namespace n {
}
```
```c++
export module b;
import a;
namespace n {
struct monostate {
friend bool operator==(monostate, monostate) = default;
};
export struct wrapper {
friend bool operator==(wrapper const &, wrapper const &) = default;
monostate m_value;
};
} // namespace n
```
```c++
import b;
static_assert(n::wrapper() == n::wrapper());
```
are rejected by clang with
```console
In file included from /app/c.cpp:1:
b.cpp:12:67: error: invalid operands to binary expression ('const monostate' and 'const monostate')
12 | friend bool operator==(wrapper const &, wrapper const &) = default;
| ^
c.cpp:3:28: note: in defaulted equality comparison operator for 'wrapper' first required here
3 | static_assert(n::wrapper() == n::wrapper());
| ^
c.cpp:3:28: error: static assertion expression is not an integral constant expression
3 | static_assert(n::wrapper() == n::wrapper());
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
2 errors generated.
```
See it live: https://godbolt.org/z/19dG3G7Pb
Introduced by c5e4afe6733c58e24023ede04275bbed3bde8240 @ChuanqiXu9
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VU2P4ygQ_TXkUuoIgx3HBx_cncloDiOttHvY2whDOWaFwQ04PdnD_PYVdpJOz2RXfdhGSJb5qPdePQpECPpgEWtSPJJitxJT7J2vlThqFaKzuGqdOtV_9AidM8a9aHuAozBaQfTCBiOidhYmq2MgtEl9Q5cuCXtMnTb4fXQ-wuDUZBAE4Y_LUisGDKOQCBZIOQ-Wu9sQ74zYXiPqYR7_TwjahOgnmXZbF6KIeJ2pOq_RKmidM-BG9CI6T_gudba9rif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