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

    <tr>
        <th>Summary</th>
        <td>
            overload resolution fails with contersion operator to const&&
        </td>
    </tr>

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

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

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

<pre>
    This (admittedly weird) code gives a curious compilation error with all versions of clang. Tested from 4.0 to 17 and main branch.

```C++
struct S
{
    operator const int&&() const;
};

void f(int&&);
void f(const int&&);

int main()
{
    S s;
    f(s);
}
```

The error message is (from compiler explorer with clang trunk @ e1f911e40ce6ad4a7f393ea1b33e65b24940eb84):
```
<source>:12:7: error: no viable conversion from 'S' to 'int'
   12 |     f(s);
      | ^
<source>:3:5: note: candidate function
    3 |     operator const int&&() const;
      |     ^
<source>:6:13: note: passing argument to parameter here
    6 | void f(int&&);
      |             ^
1 error generated.
Compiler returned: 1
```

For comparison, both gcc and MSVC both use call the correct overload using the conversion operator.

https://godbolt.org/z/orhEEhf3e

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1z6yYU_TVoc-d5BEiWtdDCceJdV8l0j-BKokXgAeT09dd3QIqduOmbqYYREh-Hc889FxGCHi1iR-onUj8XYomT8513xvQofNE79bN7m3QAwg5CzTpGVOYnvKP2irAWpFMIo75iAAFy8dotAaSbL9qIqJ0F9N55eNdxAmEMXNEH7WwAN4A0wo47eMMQUcHg3QzVroTogDYgrIJZaAu9F1ZOO1I-k_K4vffl2k6EPaWWR0P0i4zwuq1ptmEAAHdBL6LzIJ0NEbSNhO1zO6xB2BAJf_rY-Xz_zu-r0woGwg6fNra3NbfZf4G3DzjaxhzTeuw3PF8h3Lak_4QavuA0zw8SfMZ_m3DTe8YQxIiwJi5LuyYFPeBfF-M8bknJSYDoF_snkKoEpENLKValxL1QlWgG3nIUtOcc93XPqrYqsT9UmdVjPrZffgpu8RIJfyH8SBnhx4bw48otfVgHVy16g0n6zRKrAQhrXglrkgkIa7KWzU0PyoA0J_hWmTyap0n98i0PTvixXk-PmHoprNJKRIRhsTK59Q7Fbyf9L-_cWeT-P5jskyr8M5VLKkQ7gvDjMqONKf6L8GLGiB4m9HjH32f8X3vyK4-P58aHbjYZ0abgUG3ldfrwiMe4eIsqcaO_cNw56zJfhNfBWcJO0Ls4wShlLuDfXn_fRpaAINMFEKeUdO9RRnBX9MYJBUsOfp26-eFD-C-lP8V4Ccl47EzYeXSqdybunB8JO_9N2Nn56eVlGvimV6E6rlreigI72pSUlWVZH4qpqw-qGYSsBlpVVd2jrEUpaSt5S5lgqix0x0rGKWUH2vKKHnYN9qKiTT00ijViT0lV4iy02RlznRODQoewYNfwfcsKI3o0IV-rjFl8hzxJGEu3rO_Snh_9MgZSlUaHGO4oUUeD3U0aj8GZJV-lg9AmbFXrbHyQKVlmNWN2Q7F40z2opeO09DvpZsLO6byt-3Hx7g-UkbBzZhkIO-co_gkAAP__JyvKLQ">