aboutsummaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/expr.c b/expr.c
index 186e30e..099c3e8 100644
--- a/expr.c
+++ b/expr.c
@@ -159,7 +159,7 @@ mkbinaryexpr(struct location *loc, enum tokenkind op, struct expr *l, struct exp
if (l->type->kind != TYPEPOINTER || !(rp & PROPINT))
error(loc, "invalid operands to '+' operator");
t = l->type;
- if (t->base->incomplete)
+ if (t->base->incomplete || !(typeprop(t->base) & PROPOBJECT))
error(loc, "pointer operand to '+' must be to complete object type");
r = mkbinaryexpr(loc, TMUL, exprconvert(r, &typeulong), mkconstexpr(&typeulong, t->base->size));
break;
@@ -170,7 +170,7 @@ mkbinaryexpr(struct location *loc, enum tokenkind op, struct expr *l, struct exp
}
if (l->type->kind != TYPEPOINTER || !(rp & PROPINT) && r->type->kind != TYPEPOINTER)
error(loc, "invalid operands to '-' operator");
- if (l->type->base->incomplete)
+ if (l->type->base->incomplete || !(typeprop(l->type->base) & PROPOBJECT))
error(loc, "pointer operand to '-' must be to complete object type");
if (rp & PROPINT) {
t = l->type;