From: uz Date: Thu, 7 Aug 2008 22:22:58 +0000 (+0000) Subject: Fixed a bug: The op= operators (+=, -=, etc.) worked on const qualified X-Git-Tag: V2.13.0rc1~372 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1e672a316972e6f065b75143f4859e1dcafd3633;p=cc65 Fixed a bug: The op= operators (+=, -=, etc.) worked on const qualified objects. git-svn-id: svn://svn.cc65.org/cc65/trunk@3883 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- 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");