On 2 November 2013 18:57, Mischa Baars wrote: > > I understand, however it seems more logical to use the destination type to > determine the type of the first and second operand. > > Are you completely sure this is the desired behaviour?
It's the behaviour required by the C standard, so yes, it is absolutely desirable that GCC does that. The literal 1 has a fixed type and the literal 31 has a fixed type, and the expression (1<<31) has a fixed type. Whether you assign the result to a different type does not alter those types involved in the expression.