<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62888>62888</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20] Clang wrongly complains about non-constexpr declaration mismatch in defaulted comparison operator
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jensmassberg
</td>
</tr>
</table>
<pre>
Consider the following code:
```
#include <compare>
struct Foo {
friend bool operator==(const Foo&, const Foo&) = default;
};
bool operator==(const Foo&, const Foo&) noexcept;
```
Clang wrongly shows the error: "non-constexpr declaration of 'operator==' follows constexpr declaration" although non of the declarations is constexpr.
The code passes in GCC and MSCV, see https://gcc.godbolt.org/z/McsTh95nf
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycUsFunDAQ_ZrhMsqKtRfwHjhk2dJTTo16N2YAR1575THdpF9fwaI2idpLJQsw9nsz897TzHb0RDUUJyjOmZ7TFGL9Qp4vmrmjOGZd6N_qJni2PUVME-EQnAs360c0oSeQj5CfIX-EMt_WfSuk9cbNPSHIxoTLVUcC-eV-yinOJmEbAkJ1uv9DHKIl32MXgsNwpahTiCDPyxLKBM8rAkQJosGP-yOCPGNPg55dArlRQnX-_f1_rD7Qq6HrO8qPYzZO-xFvMfjRvSFP4carSBTjUuURQQgf_MPKS6_XiD0Zp6NONngMA4KoPjdVbRIz_hUFQqB2aQrzOKG_sywl311htO_Au63z9fk80eobXjUzMVqPX5sGte_x6VvzfdGAiXBK6cqLt6IF0Y7G7MbQd8GlXYgjiPYniPbJ8PN0LPyQ9bXsj_KoM6r3pTqoolRyn021PgxFpVReqaqoiA7KGFJmL1WXD1LtZWZrkQuZF0Lui0OVq92gq9LooyyHQ3UsBw2HnC7aup1zPy5L7cwyz1SXQimVOd2R4zW-Qni64XoIQixpjvWCeejmkeGQO8uJ_7Akm9ya-wbECcRJ5FCc8aObS2idtp5Rd2FO-G8fL5YvOplpUXPLIPV4D73lxaLN4myOrv6krU3T3O1MuIBol_6218M1hhcyCUS7TsUg2nXqXwEAAP__tkkvyA">