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

    <tr>
        <th>Summary</th>
        <td>
            c++20 clang choses incorrect operator== overload
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    In C++20 clang will chose the incorrect overload for this code. The overload should be ambiguous (see msvc).

https://godbolt.org/z/rox1z1Txa
```
namespace N {

struct C;
struct B;

struct A {
    bool fun(A, B, C);
    bool operator==(A const&) const;
    bool operator!=(A const&) const;
};

struct B : A {};

struct C : A {
    bool operator==(C const&) const;
    bool operator!=(C const&) const;
    C(const B&);
};
}  // namespace N

namespace N {
bool A::fun(A a, B b, C c) { return b == c; }
}  // namespace N
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydU82OmzAQfhpzGRUZEwwcOIRElXrpaV_ANg64MjiyTbrdp-9AfjZZ7SpVrcF4_szHNzPSdX-aHxPsCGtRGAVlxdTDb2MtqMEFDXHQYCblvNcqgjtpb53o4OA8ukwA5TqdwgtG3XxhcLPtQGoQozT97OYAhFVBaxjDSRFWp4TuCd2e9yHGYyD5lrDvKL3rpLMxdb5H7Q0f716zt-zlVVySOL3Iqk5i1OEolIafQMr2_uIQ_YyYdyRvHwztzfBg3r7nAy7pnIXDPCFyhLbDLNyQqPqWfYtyR-1FdJ7k-0UwAWmZQiSMY_zl_HUWy55nkXL_OeoWkLoL9q9idncxT5Dv_gv5syykrVqtC4v8nsMHzOUe4NwFcFfW-x_6tNorpu3SQfn2UjAQa8lArkWDpeeWePA6zn4CCecfRkeOBCKGfwBw7btENxnnFaOU0yLpmryr81ok0USrG_VhktYhCvcT9MD4bWiS2dvmwySYOMwyVW5ExdrT9fXt6N0vvApVE8KsAx6Kqt5UydBIzkpWZodNkZUq44rmnG5qvakqrhTnXWKF1DY0pGhJsU9MwyhjGS6W0ZwVqRJC1LIqiopSJnVHNlSPwth0-fAyk4lvVgxy7gM6rQkxvDtFCKaftL7eL-Y4ON9EI3o3CiW8cSFZQTcr4r9mz0qT">