scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit aedd026dfd916a0f93e13530af0d7dbaef791247
parent d90d76bddf5a29e8d393f1803cf3db3330e532bb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 12 Mar 2015 10:36:54 +0000

Fix castings

The ')' rigth part of the casting must be consumed before of calling
cast again, because in other case it will be an incorrect expresion.

Diffstat:
cc1/expr.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -589,6 +589,7 @@ cast(void) case FTN: error("cast specify a function type"); default: + expect(')'); if ((np1 = eval(cast())) == NULL) unexpected(); if ((np2 = convert(np1, tp, 1)) == NULL) @@ -597,10 +598,10 @@ cast(void) } break; default: + expect(')'); np2 = expr(); break; } - expect(')'); return np2; }