[expr.arith.conv]

# 7 Expressions [[expr]](./#expr)

## 7.4 Usual arithmetic conversions [expr.arith.conv]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L1161)

Many binary operators that expect operands of arithmetic or enumeration
type cause conversions and yield result types in a similar way[.](#1.sentence-1)

The
purpose is to yield a common type, which is also the type of the result[.](#1.sentence-2)

This pattern is called the [*usual arithmetic conversions*](#def:conversion,usual_arithmetic "7.4 Usual arithmetic conversions [expr.arith.conv]"),
which are defined as follows:

- [(1.1)](#1.1)

  The lvalue-to-rvalue conversion ([[conv.lval]](conv.lval "7.3.2 Lvalue-to-rvalue conversion"))
is applied to each operand and
the resulting prvalues are used in place of the original operands
for the remainder of this section[.](#1.1.sentence-1)

- [(1.2)](#1.2)

  If either operand is of scoped enumeration type ([[dcl.enum]](dcl.enum "9.8.1 Enumeration declarations")), no conversions
are performed; if the other operand does not have the same type, the expression is
ill-formed[.](#1.2.sentence-1)

- [(1.3)](#1.3)

  Otherwise, if one operand is of enumeration type and the other operand is
of a different enumeration type or a floating-point type, the expression is
ill-formed[.](#1.3.sentence-1)

- [(1.4)](#1.4)

  Otherwise, if either operand is of floating-point type,
the following rules are applied:
  * [(1.4.1)](#1.4.1)

      If both operands have the same type, no further conversion is performed[.](#1.4.1.sentence-1)

  * [(1.4.2)](#1.4.2)

      Otherwise, if one of the operands is of a non-floating-point type,
that operand is converted to the type of
the operand with the floating-point type[.](#1.4.2.sentence-1)

  * [(1.4.3)](#1.4.3)

      Otherwise, if the floating-point conversion ranks ([[conv.rank]](conv.rank "6.9.6 Conversion ranks")) of
the types of the operands are ordered but not equal,
then the operand of the type with the lesser floating-point conversion rank
is converted to the type of the other operand[.](#1.4.3.sentence-1)

  * [(1.4.4)](#1.4.4)

      Otherwise, if the floating-point conversion ranks of the types of
the operands are equal,
then the operand with the lesser floating-point conversion subrank ([[conv.rank]](conv.rank "6.9.6 Conversion ranks"))
is converted to the type of the other operand[.](#1.4.4.sentence-1)

  * [(1.4.5)](#1.4.5)

      Otherwise, the expression is ill-formed[.](#1.4.5.sentence-1)

- [(1.5)](#1.5)

  Otherwise, each operand is converted to a common type C[.](#1.5.sentence-1)
  The integral promotion rules ([[conv.prom]](conv.prom "7.3.7 Integral promotions")) are used
to determine a type T1 and type T2 for each operand[.](#1.5.sentence-2)[47](#footnote-47 "As a consequence, operands of type bool, char8_­t, char16_­t, char32_­t, wchar_­t, or of enumeration type are converted to some integral type.")
   Then the following rules are applied to determine C:
  * [(1.5.1)](#1.5.1)

      If T1 and T2 are the same type, C is that type[.](#1.5.1.sentence-1)

  * [(1.5.2)](#1.5.2)

      Otherwise, if T1 and T2 are both signed integer types or
are both unsigned integer types,C is the type with greater rank[.](#1.5.2.sentence-1)

  * [(1.5.3)](#1.5.3)

      Otherwise, let U be the unsigned integer type andS be the signed integer type[.](#1.5.3.sentence-1)

    +
          [(1.5.3.1)](#1.5.3.1)
          If U has rank greater than or equal to the rank of S,C is U[.](#1.5.3.1.sentence-1)

    +
          [(1.5.3.2)](#1.5.3.2)
          Otherwise, if S can represent all of the values of U,C is S[.](#1.5.3.2.sentence-1)

    +
          [(1.5.3.3)](#1.5.3.3)
          Otherwise,C is the unsigned integer type corresponding to S[.](#1.5.3.3.sentence-1)

[47)](#footnote-47)[47)](#footnoteref-47)

As a consequence, operands of type bool, char8_t, char16_t,char32_t, wchar_t, or of enumeration type are converted
to some integral type[.](#footnote-47.sentence-1)
