<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62880>62880</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[c++20] Clang doesn't show an error for defaulted comparison operators with mixed parameters
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
jensmassberg
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jensmassberg
</td>
</tr>
</table>
<pre>
By the standard both parameters of a defaulted comparison operator for a class `C` should be either of type `const C&` or type `C` but not mixed, see https://eel.is/c++draft/class.compare.default#1.
However, Clang accepts the following example which is declined by GCC and MSCV:
```
#include <compare>
template <class C>
struct Bar {
C i;
friend bool operator==(const Bar&, Bar) = default;
};
```
See https://gcc.godbolt.org/z/M7Y9qGrsE
Note that an error is printed if it is class without a template https://gcc.godbolt.org/z/4sb5hMn3M
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU02PpDYQ_TXmUloENk3DgcM2nd5cJpeVIuVo7KLxytjELrZ38usjA-mZTKRoJWRs14dfvaonYzR3h9ix04Vx_g1dnGWMA4Y745ydrplcafKhe2_JBq9fu8sr0IQQSTotg4bB0wSLDHJGwhDBjyBB4yhXS6hB-XmRwUTvwC8YJPkAow8gQVkZI7C66FldQJz8ajUMCGhowpDy0OuCyUF5Fwl6xuvk6cPTsEUOK4HzBLP5gZrxHiIiTERLZOIz4zfGb4g2N5Hxm2L8wvhFBzlSOiYI-Q4R8wM046LMWXFlxed9_dU_8DuGlLq30t1BKoULxY2H0VvrH8bdAX_IebEIj8moCUwEjcoahxqGV_jS9yCdhpev_e8J1rv0rC6Obz9yYZyyq0Zgoj-wMfHL-xDCebGSdo-Nxv7pESmsiuAiA7DzZb8D6MEw8TyNwaBLrfP22RUmrunjzc72RYbEN-_3XQtMXP9p6zMTO1_f9h_K2Nav_2nFXan87vXgLeU-TdvtL8ZvL-c_2j-_hPivKn_zhECTJJAOMAQfEqtLMC4NlhnBULrYCXgYmvxKIOFJzs88XMXhNL048ZLpTuhWtDLDrqybquHtWVTZ1MlSaXEum3Ychap41VaNGoayaUY1nBtsMtPxgovixEXRlCdR5bIteFULLHVZV7ypWFXgLI3Nrf0-p7czE-OKXc2bpsisHNDGQ4gOH7AZDxWGLsV8GtZ7ZFVhTaT4loUM2U3Bx1Tzgp2ux4hqj9ExfqYkrMcbgUl6_yvOncldTO9kna3Bdh8INTStQ1IP47cE6vh9WoL_hirpaysl6W4r9e8AAAD___7ZZpk">