struct A {
A();
A(int) = delete;
operator int();
};
int main() {
true ? A{} : 0;
}
Compile with C++20, Clang accepts it, but GCC and MSVC reject it with similar error messages
<source>(8): error C2445: result type of conditional expression is ambiguous: types 'A' and 'int' can be converted to multiple common types
<source>(8): note: could be 'A'
<source>(8): note: or 'int'
int doesn't seem to be convertible to A since the constructor is delete, but I'm not sure why GCC/MSVC still thinks it can. Which compiler is right?
(Demo)