Skip to content

Commit

Permalink
Fixed to handle composite types in conditional expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
mycoboco committed Dec 11, 2014
1 parent 2c17b51 commit 0be990d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/enode.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,17 @@ Tree condtree(Tree e, Tree l, Tree r) {
if (isarith(xty) && isarith(yty))
ty = binary(xty, yty);
else if (eqtype(xty, yty, 1))
ty = unqual(xty);
ty = compose(xty, yty);
else if (isptr(xty) && isnullptr(r))
ty = xty;
else if (isnullptr(l) && isptr(yty))
ty = yty;
else if (isptr(xty) && !isfunc(xty->type) && isvoidptr(yty)
|| isptr(yty) && !isfunc(yty->type) && isvoidptr(xty))
ty = voidptype;
else if ((isptr(xty) && isptr(yty)
&& eqtype(unqual(xty->type), unqual(yty->type), 1)))
ty = xty;
else if (isptr(xty) && isptr(yty)
&& eqtype(unqual(xty->type), unqual(yty->type), 1))
ty = ptr(compose(unqual(xty->type), unqual(yty->type)));
else {
typeerror(COND, l, r);
return consttree(0, inttype);
Expand Down

0 comments on commit 0be990d

Please sign in to comment.