aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--evaluate.c7
-rw-r--r--validation/bad-type-twice2.c1
2 files changed, 6 insertions, 2 deletions
diff --git a/evaluate.c b/evaluate.c
index 14922017..f63c0344 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -404,15 +404,20 @@ static inline int is_string_type(struct symbol *type)
static struct symbol *bad_expr_type(struct expression *expr)
{
- sparse_error(expr->pos, "incompatible types for operation (%s)", show_special(expr->op));
switch (expr->type) {
case EXPR_BINOP:
case EXPR_COMPARE:
+ if (!valid_subexpr_type(expr))
+ break;
+ sparse_error(expr->pos, "incompatible types for operation (%s)", show_special(expr->op));
info(expr->pos, " left side has type %s", show_typename(expr->left->ctype));
info(expr->pos, " right side has type %s", show_typename(expr->right->ctype));
break;
case EXPR_PREOP:
case EXPR_POSTOP:
+ if (!valid_expr_type(expr->unop))
+ break;
+ sparse_error(expr->pos, "incompatible types for operation (%s)", show_special(expr->op));
info(expr->pos, " argument has type %s", show_typename(expr->unop->ctype));
break;
default:
diff --git a/validation/bad-type-twice2.c b/validation/bad-type-twice2.c
index 916e8202..0aadd7a3 100644
--- a/validation/bad-type-twice2.c
+++ b/validation/bad-type-twice2.c
@@ -7,7 +7,6 @@ int foo(int x, int y)
/*
* check-name: bad-type-twice2
- * check-known-to-fail
*
* check-error-start
bad-type-twice2.c:1:8: warning: 'type_t' has implicit type