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

    <tr>
        <th>Summary</th>
        <td>
            C++20 reversed operator== not properly suppressed by operator!= in namespace
        </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>
          jyknight
      </td>
    </tr>
</table>

<pre>
    ```
namespace N {
  struct A {};
  bool operator==(A, int);
  bool operator!=(A, int);
}
bool a = 0 == N::A();
```

This should fail to compile, because the existence of `operator!=` should suppress the reversed `operator==(int, A)`. However, on Clang it does not.

Moving `bool a` within the namespace does make it correctly fail to compile, which suggests that name lookup for the operator!= is not being done in the correct scope.

@usx95 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0UsFuozAQ_RpzGTUyQyBw4EASRXvZnvYHjBnArWMj27TN36_spM1mdytZYI1n3rz3ZoT3ajJELSv3rDxmYg2zde3L5dWoaQ5Zb4dLyyp-O_zIeGfEmfwiJMEzsN3-GgTwwa0yQJdiuyMrvl56azXYhZwI1rHiGA_WHcMDKBMYNt_mYv59buyRLqlEACuOwOEKD8-s6FjRdQzrh5pHJdfvr1l58LNd9QCjUBqCBWnPi9IU2_YkxeoJwkxAH8oHMpLAjsAq_hfRin_i-HVZHHmfqhy9kfM0PFR82pBUHaCLNCu-gR_2PabHmDVw0MJMoAIMljwYGzZ_Mv9p35SZIuzVg0jgXYVZmdT3PqhUfRavFKGkdY5k0Jf_qX2flZzBr9NEPkT6IiQc0Na-rguM1iXsR-WgEjnoKfIZrCG4cbg1Ay_tQg_k2Zav_qMpIRvaYmiKRmTU5lWzy3FbFk02t3U11NXYlBVxHLEqd2VNTZnLEeuS59sxUy1yLHKeY15iXe429a7HnDd1j7JuUCDbcjoLpTdav5031k2Z8n6ltqobnmda9KR9Wn1EyXDPcI-cITI8xEj0nhXd6KwJZIb4UB4z10awp36dPNtyrXzwd_iggqb28Il1H_3j3JNZi4tBfflaFhqgv_zjrLnPMVudbucQFh_XG08MT5MK89pvpD0zPEUat9_T4uwLycDwlCR7hqek-ncAAAD__y8JNRc">