From 1e672a316972e6f065b75143f4859e1dcafd3633 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 7 Aug 2008 22:22:58 +0000 Subject: [PATCH] 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 --- src/cc65/expr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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"); -- 2.39.5