<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120812>120812</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
GH58962 regression: Clang rejects &-qualified member function to be overloaded with const-qualified with mutual exclusive constraints
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zhihaoy
</td>
</tr>
</table>
<pre>
Worked in: Clang 17
Stop working since: Clang 18
### Symptom
Clang 18.1.0 and trunk reject the following program in `-std=c++20`, but accept it in `-std=c++23`. Clang 17.1.0 accepts it in `-std=c++20`, so does GCC and MSVC.
```cpp
namespace GH58962_alt
{
template <unsigned R> struct type
{
void func() const
requires(R == 0);
void func() &
requires(R == 1);
};
template <typename T>
concept test = requires(T v) { decltype(v)(v).func(); };
static_assert(test<type<0> &>);
static_assert(test<type<0> &&>);
static_assert(test<type<1> &>);
static_assert(not test<type<1> &&>);
static_assert(test<type<0> const &>);
static_assert(test<type<0> const &&>);
static_assert(not test<type<1> const &>);
static_assert(not test<type<1> const &&>);
} // namespace GH58962_alt
```
https://godbolt.org/z/vY63TE43K
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyclE1v4zYQhn_N-DKIQJGyPg46-CPeAkUvu0GLnhYUObHZUKKWpJxmf31ByUm87QabrkGABjXPzPsOwZEhmONA1MJ6C-v9Sk7x5Hz79WRO0j2tOqef2j-cfyCNZgCxwZ2VwxHzCtjmU3QjPjr_YIYjBjMougqogW3S4mJZ-OmpH6Prl-PnoCzPGMpBY_TT8ICe_iIVMZ4I75217jFlHr07etmjGRBKdhOiBrFXwLfAt5xByYDvsJsiSqVojGji90MFlCx70b9UnonwJvKcPTjUjgJ-2O1mtb99-n2XXQyWbFlqHIFtBtlTGKUi_PDLum5K_lnamMKq7RIfqR-tjIQgdtMwN1_jRxC3GKKfkvmnkV4ARMSzMxrvp0EBr4E3qNwQ4uVb-nn6MhlPAXj9EUHsQeyRAW9AvJUBePkDPn_hodpf_nyrPclMZvEOxC2wjXLD3P1IIaYs12nv8DyXrbaoSdnZIa_T2WXLXsWB2OJ1zRBlNOqzDIF8BF6n_JfyIHYsNS7ZEbcvit9J_B8of0eZwS3mv0N9C75P4nzLP2Htlfspue8q-0P2P4ah2iPwA_ADvvlCnh_SQpxiHAOIzUIdne6cjZnzR-CHr8AP5z9LcXdbiF-BbVa6FboRjVxRm1eiqArerJvVqW2UbnhHTJWCCt7UTZVr6sq1LITsKl2vTMsZL3LOc5YzLqqsqoumZJrVWuk1NQUUjHppbGbtuU_lVyaEidqcszrnKys7smEenpyrNFqA8zRHfZuAm246BiiYNSGG1xTRREvtxT56OnoKwbir-boMwpCaefNlktbcG9LYU9-Rn19yNG7A6LAjdGfy1klNGh9NPC3XcEXNh_0UJ2mR_lZ2CuZMS5SXZohhNXnb_qvfJp6mLlOuB35Iui_bzehdUgb8MPchAD9cWnFu-T8BAAD__zpF4UQ">