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

    <tr>
        <th>Summary</th>
        <td>
            clang candidate constructor behaves differently when it's implicitly defined
        </td>
    </tr>

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

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

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

<pre>
    A user provided assignment operator works for some reason, as does also doing the implicit conversion without the assignment operator, but when the assignment operator is implicitly defined and you also have the implicit conversion it seems to not get the user defined conversion sequence correct. Note that the return type of the conversion sequence is const. Not a big deal.

```
struct A
{
    //A& operator=(const A& o);    
};
struct X
{
        operator const A();
};
void f()
{
    X a{};
    A b{};
    b = a;

    const A& c = a;
    b = c;
}
```

> <source>:13:9: error: no viable conversion from 'X' to 'A'
>    13 |     b = a;
>       | ^
> <source>:1:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'X' to 'const A &' for 1st argument
>     1 | struct A
>       |        ^
> <source>:1:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'X' to 'A &&' for 1st argument
>     1 | struct A
>       | ^
> <source>:7:2: note: candidate function
>     7 | operator const A();
>       |         ^
> <source>:1:8: note: passing argument to parameter here
>     1 | struct A
>       | ^

https://godbolt.org/z/zcn7oTfjc
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU2TozYQ_TXtS9e6ZAmMOXBgPpxbTjnMVUAD2gW1IwlPOb8-JfDYnomd1Fa2Si5Mq_vpvSeJ1t6bzhIVkD5B-rLSU-jZFb_17MMzOxLZquLmVJQ4eXJ4cHw0DTW41I1kA_KBnA7s8J3dD48tO_Q8EjrSni3IZ9QeGyaPevCMDRvbYegJzXgYTG0C1myP5Lxhi-8m9DyFef7OGhGtmgK-92Qf5aDxF-jhhA21xkbGtsETTwuJXh_pIQcT0BONHgO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