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

    <tr>
        <th>Summary</th>
        <td>
            [clang][c++20] Match requires clause while considering operator == with reversed arguments 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++20,
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    This is regarding one unimplemented bit of [P2468R2](https://wg21.link/p2468)
We must match the trailing requires clause [basic.scope.scope#4.3.1](https://eel.is/c++draft/basic.scope.scope#4.3.1) to check if we have a "**corresponding** `operator !=`.

Precisely, The following code should pass.
```
template<int x>
struct A {
bool operator==(int) requires (x==1); // 1.
bool operator!=(int) requires (x==2); // 2.
};
int a1 = 0 == A<1>();
```
Reversed 1 should be considered for `0==A<1>` (//2 does not forbid reversed operator).

Currently, in the first attempt I could not find a way to match requires clause.
Eg:
```
template<int x>
struct A {
bool operator==(int) requires (x==1); // 1.
bool operator!=(int) requires (x==1); // 2.
};
int a1 = 0 == A<1>(); // This is expected to error as we have a matching operator !=.
```


Note: This was not addressed in #57711 as it aims to fix **backward incompatible** change of C++20 of ambiguity in `operator ==` with reversed argument order. I do not expect this to be a very pressing issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVU2PozgQ_TVwKS3CJpBw4JBOz0p7mNFoNNKcDS7A2w5mbdNJ_v2UcTLprLJ72stKFuCv8nuvyo_WyEvzfVQOqFkchJVqGsBMCMukjrPGI04eJbTKg-khKV--8k21-8aT8jXhu9H72SXFPuG_UzsNnGVaTW_0PYdlCa-T_DXJ9z8QjovzcBS-G8GPCN4KpcNZFv9alEUHnRaLw3BEK5zqMteZGeMz4cUmKzL27FBEnSlHH13CX6hJK3pP3X8OwmvwBroRuzdQPZwQRvGOICDhPOEUdt8ZS4hmM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