C# Specification, Section 7.17.2 Compound assignment:
An operation of the form x op= y
is processed by applying binary operator overload resolution (§7.3.4) as if the operation was written x op y
. Then,
...
• Otherwise, if the selected operator is a predefined operator, if the return type of the selected operator is explicitly convertible to the type of x
, and if y
is implicitly convertible to the type of x
or the operator is a shift operator, then the operation is evaluated as x = (T)(x op y)
, where T
is the type of x
, except that x
is evaluated only once
And that's exactly the situation we have here. The return type of the operation is int
but the types of x
and y
are both char
, and so an extra cast is automatically inserted for us.
(I believe this rule exists because there's nowhere for you to be able to insert an explicit cast yourself and it's kind of "expected" to work, especially in cases where x
and y
are the same type)