Implicit conversion: is the following warning valid?

Viewed 381

This question Implicit type conversion rules in C++ operators (and several others) state

If either is long long unsigned int the other is promoted to long long unsigned int

However if I do the following under MSVC:

unsigned int a = <some expression>;
unsigned long long b = a << 32ULL;

The second line generates the following warning:

warning C4293: '<<': shift count negative or too big, undefined behavior

32ULL is a 64 bit unsigned value, therefore according to the implicit conversion rules this should mean that a is converted to unsigned long long as well. Hence I'm shifting a 64 bit value by 32 bits, clearly a well defined operation.

Is MSVC bugged or is there a flaw in my logic?

1 Answers
Related