ref: cdafe864ddbdca6af43660f88bff661afb6b42de
parent: 5215b34485aa15d4dccfe7f2115c3d6701fdcf5c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Apr 16 03:25:59 EDT 2014
Promote expressions in ternary operator All the expressions must be promoted before of checking types, and in ternary operator we will compare the types of the expressions in some moment.
--- a/expr.c
+++ b/expr.c
@@ -659,9 +659,9 @@
cond = or();
while (accept('?')) {
- ifyes = expr();
+ ifyes = promote(expr());
expect(':');
- ifno = ternary();
+ ifno = promote(ternary());
/* TODO: check the types of ifno and ifyes */
cond = ternarycode(compare(ONE, cond, constcode(zero)),
ifyes, ifno);
--
⑨