Skip to main content

promote

Function promote 

Source
pub fn promote(types: &mut Types, id: TypeId, target: &TargetInfo) -> TypeId
Expand description

The integer promotions, 6.3.1.1.

Anything narrower than int becomes int, or unsigned int when int cannot hold every value it had. Everything else, floating types and pointers included, is its own answer, so this can be called on any operand without asking what it is first.

The qualifiers and _Atomic come off, because by the time a value is being promoted the lvalue conversion of 6.3.2.1 has already happened and neither of them is part of the value.

_BitInt is deliberately not promoted. That is C23 6.3.1.1p2, and it is what both compilers do: +x on a _BitInt(8) is still a _BitInt(8).