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

    <tr>
        <th>Summary</th>
        <td>
            Clang can't choose between operators int/bool for operator<
        </td>
    </tr>

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

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

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

<pre>
    ```c++
struct eee {
        operator int() const { return 5; }
        operator bool() const { return true; }
};

int main(int argc, char** argv)
{
        eee f;
        if (f < 0) {}
}
```
https://godbolt.org/z/4Gnfo4Pqf

Expected: There is no operator<(bool,int), so choosing operator<(int,int) would require the fewest conversion operations, and should be chosen.
Actual: Prints a dozen candidate operator<, and thinks operator<(float,int) is the most relevant one.
```
<source>:9:8: error: use of overloaded operator '<' is ambiguous (with operand types 'eee' and 'int')
    9 |         if (f < 0) {}
      | ~ ^ ~
<source>:9:8: note: because of ambiguity in conversion of 'eee' to 'float'
<source>:2:2: note: candidate function
    2 | operator int() const { return 5; }
      |         ^
<source>:3:2: note: candidate function
    3 |         operator bool() const { return true; }
 |         ^
<source>:9:8: note: built-in candidate operator<(float, int)
    9 |         if (f < 0) {}
      |               ^
<source>:9:8: note: built-in candidate operator<(double, int)
<source>:9:8: note: built-in candidate operator<(long double, int)
<source>:9:8: note: built-in candidate operator<(__float128, int)
<source>:9:8: note: built-in candidate operator<(int, int)
<source>:9:8: note: built-in candidate operator<(long, int)
<source>:9:8: note: built-in candidate operator<(long long, int)
<source>:9:8: note: built-in candidate operator<(__int128, int)
<source>:9:8: note: built-in candidate operator<(unsigned int, int)
<source>:9:8: note: built-in candidate operator<(unsigned long, int)
<source>:9:8: note: built-in candidate operator<(unsigned long long, int)
<source>:9:8: note: built-in candidate operator<(unsigned __int128, int)
1 error generated.
```
I think this is a rejects-valid (GCC, MSVC, and my intuition all agree that operator int() should be chosen), but even if it's instead an accepts-invalid in the others, naming float in the error is rather unhelpful, isn't it?

(Bonus issue: Change to operator float(), and Clang prints an error naming 146 different operator<. I think that one is also rejects-valid, for the same reason. https://godbolt.org/z/Y8joWar89)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0Vk1v4zYQ_TX0ZRBDpixLOuigeONFDwUWaNGip4CSRhK3NOnlh9Pdw_72YijFiZ1Nt906ghMn1Hy8eUPyjXBODhqxYtkty94tRPCjsVWtWmHNojHd54ptkunTMn5Ln6R23obWAyICy2mBJaU5oBXeWJDaM14wXkJrtPNkARZ9sBoylt4Cy99deDTGqNdcvA34zCt_x9IpYS21h72QmvGC_hR2aBnfQjsKy3jNeE1LR8bL6DejJMj9Y4hS9sB40QNLt5BQerI7JUrqU-ksqUfvD46lNeM7xneD6Rqj_NLYgfHdF8Z36_e6N-sPn_oJ3d1fB2w9diyt4dcRLYJ0oA08Fs3SLePFVPk2UlYSemegHY1xUg8XptFmtoQHE1QHFj8FaRH8iNDjAzpP_B3ROmn07C6NdhRY6A7cGN0apBwO9ZIldd36IBSh_GCl9g4EdOYLamiF7mQnPJ7jmCL5Ueo_3QXCXhnxDKN0EdjeOA8WFR6F9mA0Li-IZenWmWBbZOkdS-uSpXVBeNBailxDcAimB3NEq4zosDvlBcbzmDunbGLfyCGY4KipD9KPkx3B_XxAWs0RkYxpjfE8As2nHQIAQP3fwuPz-uaY3pPtV2DZHXz9hyq08UjfDbZiLmTCKf1nkPqsYf0ziN7QPzOl-csEfP45JXjqVx90S32fkfKI9D8ez6cSHx-W3b1Ekf5rFOlZsB84-t8H85LzIJW_ka_u5dOOhfkA_ug2OH-uBK4zoVF4hu5_x1RGD_AWge_vI5crauU140633pUZeANOrx_2_l7q6_MZdNT7Dq5O7Cny9ak4C_2W8b_J-WpSIhhQkxN2lwL20ySH9NtFHQKLH7H17uYolCSlKd5vo3T-_MtvJwnd0_Xvg6Q7EoRSIAaLpOXCf-uyvtTueV5oggc8oqZrSpJS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