C++ only

Types in conditional C++ expressions

In C++, a conditional expression is a valid lvalue if its type is not void, and its result is an lvalue.

Table 21. Types of operands and results in C++ conditional expressions
Type of one operand Type of other operand Type of result
Reference to type Reference to type Reference after usual reference conversions
Class T Class T Class T
Class T Class X Class type for which a conversion exists. If more than one possible conversion exists, the result is ambiguous.
throw expression Other (type, pointer, reference) Type of the expression that is not a throw expression
End of C++ only