<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58962>58962</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang, trunk, c++20] Constrained functions with differing reference qualifiers cannot be "overloaded"
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          CalebAdrianXYZ
      </td>
    </tr>
</table>

<pre>
    Given the following class definition:

```cpp
template<unsigned R>
struct type
{
    void func() requires (R == 0);
    void func() & requires (R == 1);
    void func() && requires (R == 2);
};
```

I would expect the following test code to pass:
```cpp
#include <utility>

template<typename T>
concept test = requires { std::declval<T>().func(); };

static_assert(test<type<0>&>);
static_assert(test<type<0>&&>);
static_assert(test<type<1>&>);
static_assert(not test<type<1>&&>);
static_assert(not test<type<2>&>);
static_assert(test<type<2>&&>);
```

Both the class definition, and the test code successfully compiles on GCC, MSVC, and NVC++, however Clang++ rejects the class definition with the following errors:

```
<source>:7:10: error: cannot overload a member function with ref-qualifier '&' with a member function without a ref-qualifier
    void func() & requires (R == 1);
         ^
<source>:6:10: note: previous declaration is here
    void func() requires (R == 0);
         ^
<source>:8:10: error: cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier
    void func() && requires (R == 2);
         ^
<source>:6:10: note: previous declaration is here
    void func() requires (R == 0);
```

Given that these functions have disjoint constraints, they should not conflict, and clang should accept this code as provided.

Corresponding CE link: https://godbolt.org/z/oE36nGMMo
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVk2T4yYQ_TXyhVqXDLZkH3SwNR-Vw-SwSaWyuaQQtMZsMGgB2XF-fRpk2TMZz9Zkdw6rQhKoabrfo7tRY-Wxuld7MCRsgbRWa3tQ5pEIzb0nElplVFDWZGyd5TdZPj6LfGii64YvAXad5gEyVvfGq0cDknzM2O0g9c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