aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-19 12:18:27 -0800
committerMichael Forney <mforney@mforney.org>2019-02-19 12:18:27 -0800
commitd13019290ee2e7f41369f1d31ce903efd26cfd05 (patch)
tree4fb4d2fdee4319aea41cac267dbb9dc5a4a5310f
parentf67a34503489f74fce416ce4447f291534c21f8f (diff)
Check that left hand side of assignment expression is an lvalue
-rw-r--r--expr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/expr.c b/expr.c
index 11d6fbe..aad7cbc 100644
--- a/expr.c
+++ b/expr.c
@@ -841,6 +841,8 @@ assignexpr(struct scope *s)
default:
return l;
}
+ if (!(l->flags & EXPRFLAG_LVAL))
+ error(&tok.loc, "left side of assignment expression is not an lvalue");
next();
r = assignexpr(s);
lvalueconvert(r);