- expression_t *const condition = expression->conditional.condition;
- expression_classification_t const cclass = is_constant_expression(condition);
- if (cclass != EXPR_CLASS_CONSTANT)
- return cclass;
-
- if (fold_constant_to_bool(condition)) {
- expression_t const *const t = expression->conditional.true_expression;
- return t == NULL ? EXPR_CLASS_CONSTANT : is_constant_expression(t);
- } else {
- return is_constant_expression(expression->conditional.false_expression);
- }
+ expression_t *const cond = expression->conditional.condition;
+ expression_classification_t const ccls = is_constant_expression(cond);
+ if (ccls < EXPR_CLASS_CONSTANT)
+ return ccls;
+ expression_t const *const t = expression->conditional.true_expression;
+ expression_classification_t const tcls = t == NULL ? ccls : is_constant_expression(t);
+ expression_classification_t const fcls = is_constant_expression(expression->conditional.false_expression);
+ if (ccls == EXPR_CLASS_INTEGER_CONSTANT &&
+ tcls == EXPR_CLASS_INTEGER_CONSTANT &&
+ fcls == EXPR_CLASS_INTEGER_CONSTANT)
+ return EXPR_CLASS_INTEGER_CONSTANT;
+ expression_classification_t const cls = fold_constant_to_bool(cond) ? tcls : fcls;
+ return cls < EXPR_CLASS_CONSTANT ? cls : EXPR_CLASS_CONSTANT;