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

    <tr>
        <th>Summary</th>
        <td>
            Reference initialization involving deleted conversion function wrongly diagnosed as "ambiguous"
        </td>
    </tr>

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

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

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

<pre>
    Code:
```
struct Cat { };
struct Dog {
    operator Cat();
    operator Cat&() = delete;
};
Cat const& r = Dog{};
```
Clang 17.0.1 (all language versions from c++11 to c++2b) gives the wrong diagnostic, reproduced below:
```
<source>:6:12: error: reference initialization of type 'const Cat &' with initializer of type 'Dog' is ambiguous
    6 | Cat const& r = Dog{};
      |            ^ ~~~~~
<source>:3:5: note: candidate function
    3 |     operator Cat();
      |     ^
<source>:4:5: note: candidate function has been explicitly deleted
    4 |     operator Cat&() = delete;
      | ^
```
There's no ambiguity; under [[dcl.init.ref]/5.1](http://eel.is/c++draft/dcl.init.ref#5.1) and [[over.match.ref]/1.1](http://eel.is/c++draft/over.match.ref#1.1), the first stage of overload resolution involves `operator Cat&` only.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVN2SqzYMfhpxozkMyAEOF1zkZ_MAnb6AwQLcceyMbbJNL_rsHZN02d2e7Wk9mQlgSZ-k75NkCHqyzB1UB6hOmVzi7HwXhQ3OZ71T9-7oFIPYQ3GCYg918fytryH6ZYh4lBGhOSA0JxCHD1cnN6WrxzdERHdlL6PzyQnoO1D75vLP6_phgSBOqNhw5Dfj91gJf3A2JA_0q_XJTQn2ndGn1I9G2gnLJi_yEoG-S2MwfVrkxHhjH7SzAUfvLjgAHYAOZYnR_f1Cfcpr0jcOGGfGV-_shErLyboQ9QB0RM9X79QysMKejXv9qosgjsEtfmAQLyD2NYh9SSD2yN47nx48j-zZDoza6qil0X_IqJ1FN2K8XxmBmrUBDypS3xp81XHe7Nm_N07toQZ1QHnp9bS4JWwc1AjNEf9TU3E9yfzdgeoF_0znh-UJEPsqFWVdonOPg7RKKxkZx8UOqawttniL_RPdbElA9fJD3N3PcXGWAXtmi_z71ehBR3N_6k5tULsvcvoXsW4Zbtl91MCvM3sGagJa9-RExzuIAy5Wscd1Pg9qMHliNPc8QnUCOld5uT58n2O8JoHRGejMbHIdgM5PtSovxwh0_uBPIjlTi9KqZ3x3Y59fZBzmDaH8XwifIpAoV4w0DmlMRu1DxBDTkLkRk7VxUqHn4MyycqDtzZk0VlAXnxtcF-isueeZ6oRqRSsz7sqmKKuqLpsqm7vdwNxX_VgroZqyLsaelOxbMfQk2lZUme6oIFFSQUTUiioXilXflmPV7yoSFcGu4IvUJjfmdsmdnzIdwsJds6OSMiN7NmHdlkSWX3G9BKK0PH2XfL71yxRgVxgdYtiiRB0Nd798NciPqnXaIQ-9pdl7rqFNn-uWSZp87BlWKAMC0TbERNniTZe4Cm9kTTrOS58P7gJ0Thk9_75dvfuNh8TbWkfic63zrwAAAP__NZ3N2g">