<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104720>104720</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
trunk regression: operator== is not defined
</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 C++20 program
```
#include <compare>
struct A {
friend constexpr auto operator<=>(const A &, const A &) = default;
};
constexpr bool operator ==(const A &, const A &) noexcept;
static_assert( ((bool(*)(const A &, const A &))&operator==)( A{}, A{} ) );
```
is accepted in GCC and Clang 18.1, but the current Clang trunk rejects it with the error
```
<source>:9:16: error: static assertion expression is not an integral constant expression
9 | static_assert( ((bool(*)(const A &, const A &))&operator==)( A{}, A{} ) );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:9:16: note: undefined function 'operator==' cannot be used in a constant expression
<source>:4:27: note: declared here
4 | friend constexpr auto operator<=>(const A &, const A &) = default;
| ^
```
Online demo: https://gcc.godbolt.org/z/ssqxsoYac
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVMGO4zYM_Rr6QmwgU05sH3zwOJsee-mlp0KWGEetI6WSvDvtod9eyPE0O4MpBihQrGHYtCXyPT6SUjHayTF3sH-C_bFQS7r40J3YhGL05o_up4uNOAA9AT2RwFvwU1BXEEcQPRzEdt8_SVqn58Uwghy0v95UYJCft9X1GVNYdMIeoX66_0FEPAfLzqD2LiZ-vgVUS_LobxxU8gHkAPKYA1GzbsnudAAa8NVniyCPaPisljmB3OJDfXzY6_MBM3o__wODK8jxQxDn-VnzLb2JGpNKVv-iYuSQgBoEaoCaDLFaPVD7Uez1PjzyvvPJbthnwepj9tlMXDOm9sHjdTlsRKUzUTZoHf4wDKicwWFWbsKy2ZU51rgkTBdGvYTALm2rKSzuNwz8K-sU0Sb8atNl3cch-PB-9eUQ_RL0WnHZtyD78gCy31xkj3eF8K6Q9Q5zDTjGbNqIzidUDq1LPAU136VRLn2z7dExLUI94PfXHNcrc4H957_-2_WBfs4nzu_FGT5bxwbPi9OrgED1W-I1auWylCPjEu-lV_-u5RvUCmRP9beohvWsAhu8cOBHztWa8_89u6_UfbfrfnSzdYyGrz6zvaR0iyB7oBPQadJ6N3kz-jntfJiATn8CnWL8_Tn6n5UuTCdNK1tVcFfWVIlSCrEvLl0plNJtfdbiTKIVlRrNyM1BVmrfNvJcF7YjQZVoyoZE9tkZrViNo1D1XuvyoKASfFV23s3zl2vGLmyMC3elqGoSxaxGnuN65hI5_orrKhDlIzh02enTuEwRKjHbmOIjTLJp5u5lPqeXWsoeXzfCy0BtLVMsYe7eiGPTZRl32l-BTjn-9vp0Cz7PPdBpZRWBThvtLx39HQAA__8ml9vT">