<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92497>92497</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
nameless struct leads to deleted operator== with no diagnostics
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tiagomacarios
</td>
</tr>
</table>
<pre>
The following code:
https://godbolt.org/z/rM83Md9jT
```
struct S {
struct {
bool b;
};
bool operator==(const S&) const noexcept = default;
};
bool f(S const& a, S const& b) { return a == b; }
int main() {}
```
Fails at link time with:
```
<source>:9:(.text+0x19): undefined reference to `S::operator==(S const&) const'
```
gcc diagnostics are much better and earlier (compile time):
```
<source>:9:46: error: use of deleted function 'constexpr bool S::operator==(const S&) const'
9 | bool f(S const& a, S const& b) { return a == b; }
| ^
<source>:6:10: note: 'constexpr bool S::operator==(const S&) const' is implicitly deleted because the default definition would be ill-formed:
6 | bool operator==(const S&) const noexcept = default;
| ^~~~~~~~
<source>:2:5: error: no match for 'operator==' (operand types are 'S::<unnamed struct>' and 'S::<unnamed struct>')
2 | struct {
| ^~~~~~
```
Could we add the same warning as gcc?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVc2S4jgMfhpxUTUVZELIIQcamtucel7AiRXwrGNTtrN072GffcsODXQP-1O140pBWZEUfZ8-yzIEfbDMDZTPUO5mcoxH55uo5cENspNeuzBrnXpvvh8Ze2eMO2t7wM4pBrGBYgfF5hjjKaQd7YH2B6daZ-Lc-QPQ_g-gvf-2Ft9U_eP75A6r4vLkbYh-7CK-IlTPkwUR8WL9ZEurdc5gC-LODNXuur9Zs6M7sZfReRC79NC6czZEfAVaAdU47azjt45PEUHsUHEvRxNvCX9KnhP3QOvXKR5ohRJoi3f7NmWH6hk9x9FblDhVkCvPBd8l1DbiILUFWl_Cbg6fqZp-91KbgDKi0fY3jHpgPOt4vLb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