4.20 The Conditional Operator
In a conditional expression of the form
test ? expr1 : expr2
the test expression may be of any type.
If the conditional expression is contextually typed (section 4.23), expr1 and expr2 are contextually typed by the same type. Otherwise, expr1 and expr2 are not contextually typed.
The type of the result is the union type of the types of expr1 and expr2.