Given this program
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/E7oP6hcP6