I have updated my MSVC to 16.7 and now he complains about the following code:
error C2668: ... ambiguous call to overloaded function
void f(int){
}
void f(double){
}
int main()
{
long l = 5;
static_assert(sizeof(long)==4,"");
f(l);
}
It used to compile in older compilers https://godbolt.org/z/PG7GTY
I understand why GCC and Clang complain, since their long is 8 bytes, but why would MSVC reject this code when long on MSVC is 32bit, aka same as int.
Does C++ standard requires this to be ambiguous, or is it fine for implementation to consider long as int for purposes of overload resolution if the are "same underlying" type.
If it matters I am compiling with C++20 flag on MSVC.