Type of ternary expression
The type of the expression ‘1’ is char. The type of the expression (test ? 3 : ‘1’) is at least int (or an unsigned version thereof; portably it is std::common_type_t<int, char>). Therefore the two invocations of the << operator select different overloads: The former prints the character as is, the latter formats the integer … Read more