<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132600>132600</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] user-defined conversions failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
changkhothuychung
</td>
</tr>
</table>
<pre>
Given this program
```cpp
struct Alloc{};
struct MyString
{
MyString();
MyString(MyString&&, const Alloc&);
MyString(MyString&&);
MyString(const MyString&, const Alloc&);
MyString(const MyString&);
};
struct A
{
operator const MyString() const;
};
int main() {
MyString s(A{}, Alloc{});
return 0;
}
```
Clang reports error `no viable conversion from 'A' to 'MyString'`, but gcc doesn't complain about it. The issue goes away when I change `operator const` to `operator`. Is this a bug in clang? If yes, I would like to work on this issue.
link to compiler explorer: https://godbolt.org/z/xKfs8GoPr
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVNGOmzoQ_RrzMlrkmIDJAw8kEavo6kqV2h8wMIAbx0a2STb9-srANpvVqqo0UqyTmTPnjMcI52SvEQuS7kl6jMTkB2OLZhC6Pw_GD9O9GSbdR7Vp78WrvKIGP0gHozW9FRcgtAyR0SWacSS0dN5OjYdSKdMQvif8SJL9mrr-9__9u7dS9wHke0LLB8JywnYkmUGAj_jjmM1xgMZo994oILu10d-q_uQ8ky9UT8n_xv9F4Xva4vzJePlwDABmRCu8sfCZJMxgAb-gktrDRUi9pj3o3uvBEZaX6-jZ4ekmnvxb9JPVQFdqfvx4mUuzgxK6B4ujsd4BWmsskIxqA1cpaoVB5RWtk0ZDZ80FCOMlYRy8CceHJR4o2QHqyUPfNNAadJow7qExl1EJqUHUZvIgfQw_BgTp3ITQG3QgbuIOtwE1nGBeTgwanqdHMjr3fOAkozGc3LKxAuqpB6mhCYZIUsGpgzu6IOkENzOpFpQ8Y-C4GXsGs676LCNe11dJfQ4ZQbJUaAHfRmUsWpKUMHg_OpKUhFWEVb1pa6N8bGxPWPWLsOrtv87lr-abjdoiaXfJTkRYbPiW8c2ObXg0FFSIvOsop11GacYxT7uc5y0mNcs3abuLZMEoS2nCEppv6YbHTd52W9GkrOUNz7uUbClehFSxUtdL6B3N-otNwjJKIyVqVG5-7owtk2AsvHxbhIKXeuod2VIlnXcPCi-9mr8RS0V6hMmhfWmxkxrbDxvgoBNSYRtHk1XFp3lIP0x13JgLYVWgXn9eRmt-YuMJq2apjrBqVXst2O8AAAD__4nabJc">