The following code compiles fine on all compilers I've checked (clang, mingw, g++) other than MSVC.
enum class Foo{BAR};
bool operator==(Foo a, Foo b)
{
return (int)a & (int)b;
}
int main(int argc, char *argv[])
{
Foo::BAR==Foo::BAR;
return 0;
}
MSVC fails with the following error:
>main.cpp(10): error C2593: 'operator ==' is ambiguous
>main.cpp(3): note: could be 'bool operator ==(Foo,Foo)'
>main.cpp(10): note: while trying to match the argument list '(Foo, Foo)'
Any insight would be great, I've been scratching my head about this all day.
My version of MSVC is 14.0 however I've tested it online with version Version 19.00.23506 and the same error appears.
The error does not apear with version 19.11.25331.0 however. Compiler bug then?
operator==because it does not test equality. - piwi