scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit cdafe864ddbdca6af43660f88bff661afb6b42de
parent 5215b34485aa15d4dccfe7f2115c3d6701fdcf5c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 16 Apr 2014 07:25:59 +0200

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.

Diffstat:
Mexpr.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/expr.c b/expr.c @@ -659,9 +659,9 @@ ternary(void) 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);