#include <iostream>
void foo(int) = delete;
void foo(long) = delete;
void foo(unsigned long i)
{ std::cout << "Wow " << i << "\n"; }
int main()
{
auto const i{ -2147483648 };
foo(i);
}
This code will not compile on GCC or Clang, since -2147483648 is a long. However, MSVC thinks this should be an unsigned long and happily compiles this code. i is 2147483648, by the way. Without the negative.
https://godbolt.org/z/jnb7f47W4With MSVC, there's a /permissive- flag to enable "standard conformance mode". Even with that enabled, the literal is still a different, since it becomes a long long. facepalmSo the code doesn't end up compiling, but for the wrong reason: it says the call is ambiguous.