I've compiled simple UB code without any warnings or errors using Visual Studio 2019:
int main()
{
int i = 10;
i = i++ + ++i;
return i;
}
I've turned on EnableAllWarnings(/Wall) and treat warnings as errors(/WX) flags. It compiled into:
mov eax,17h
ret
Because compiler generated this code, I'm sure that he detected UB. Why doesn't MSVC generates any warning about UB?
I've checked that Clang and GCC gives warnings for this example. Do they generate warnings for any possible UB? If so, why MSVC doesn't?