<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/105248>105248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Redeclaration of explicitly defaulted comparison operator makes it undefined
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Fedr
</td>
</tr>
</table>
<pre>
This program
```
struct A {
friend constexpr bool operator ==(const A &, const A &) noexcept = default;
};
constexpr bool operator ==(const A &, const A &) noexcept;
static_assert( A{} == A{} );
```
looks valid and it is accepted by EDG and MSVC. But Clang rejects it with the error
> undefined function 'operator==' cannot be used in a constant expression
GCC unfortunately has a similar issue.
Online demo: https://gcc.godbolt.org/z/azqbosPTd
Related discussion: https://stackoverflow.com/q/78889523/7325599
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU0Fv2zwM_TXyhWhgS3EsH3xIk7qnD9_QFbsOskTHWmUpleS06a8f5CRNul0HCLZok498j6QIQe8sYkPKe1JuMzHFwfmmReWzzqlj8zzoAHvvdl6MJN-SfE1W-fnMZoh-khHWQKr70xcAgN5rtAqksyHi-95D55wBt0cvovNA2DYdymeHFExXhG7gi1mDdfgucR-TPyjsxWQiYec0pNpe7_PzH2X7RA1RRC1_ihDQR0I5rBPHansGvJq0vlbyVR3j3EuAgzBagbAKdAQdQMiUBxV0R3jYPs5__vv-Y7OA-ynCxgi7A4-_UMaQIt50HCAOCOi987eMCXuAySrstUUF_WRl1M4CodWF_IV7BVJY6yJ0CFNABdqCOCkgbISkGoagnb2Ff9xsYLK983GyIqI5wiACCAh61EZ40CFMuLiN-N8abREUjo6wNQwx7gNha0JbQtudlIudU50zceH8jtD2g9BWfLx2Lnx7Vrc4T2hEEkjpIKdTXX_BhSjkizug7417W0g3Etq-EtpWnPO6pCxdGS3Lus5Uw1TNapFhU1R0WfC8qFg2NIXiJe_7itIVRaloUXAuOKvzrmR50XWZbmhOlzmnecHLVcEWbFWtloqrZYmSYc_JMsdRaLMw5jAmVtksSlPkJV3yzIgOTZi3i1KLbyfJCKVp2XyTgu66aRfIMjc6xHCFiToabJ5QoTTCi7mvrk-NMlrqaI6XhcC0ZuNeeB2Sy2XoR_GC8_R8zkc2edP80REdh6k7a5dSn193e-_S-BHazgUHQtszo0NDfwcAAP__5JtOuQ">