@J.Hilk said in Conditional operator as a statement:
is totally legit.
Only because int is "promotable" to double. They do not have to the same return type but they at least have to have promotable/convertible return types.
The (academic) question is whether that is enforced by the ? : operator itself or whether it is only enforced on (say) assignment of the result to a variable or usage in a condition. The situation we are discussing is the (peculiar):
a ? b() : c();
as a statement, so the result is never used. I still imagine it's the : operator which demands the type compatibility even if the result is not used.
BTW (I just discovered) the "Standard" says something along these lines:
5.17/3
If the second and third operand have different types, and either has (possibly cv-qualified) class type, an attempt is made to convert each of those operands to the type of the other. The process for determining whether an operand expression E1 of type T1 can be converted to match an operand expression E2 of type T2 is defined as follows:
and then, of course, loads of cases.....