diff --git a/src/cc65/expr.c b/src/cc65/expr.c index a9e0bee54..daf1e2abe 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -2777,6 +2777,11 @@ static void opeq (const GenDesc* Gen, ExprDesc* Expr) return; } + /* The left side must not be const qualified */ + if (IsQualConst (Expr->Type)) { + Error ("Assignment to const"); + } + /* There must be an integer or pointer on the left side */ if (!IsClassInt (Expr->Type) && !IsTypePtr (Expr->Type)) { Error ("Invalid left operand type"); @@ -2875,6 +2880,11 @@ static void addsubeq (const GenDesc* Gen, ExprDesc *Expr) return; } + /* The left side must not be const qualified */ + if (IsQualConst (Expr->Type)) { + Error ("Assignment to const"); + } + /* There must be an integer or pointer on the left side */ if (!IsClassInt (Expr->Type) && !IsTypePtr (Expr->Type)) { Error ("Invalid left operand type");