From 43c89d5fd0f837882c44b244cdd911b398c3c63d Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 5 Oct 2009 17:37:45 +0000 Subject: [PATCH] Fixed a bug: A struct field has all qualifiers from its definition plus the qualifiers of the struct. git-svn-id: svn://svn.cc65.org/cc65/trunk@4329 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index ef0b25da2..ac7f72dc0 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1070,6 +1070,7 @@ static void StructRef (ExprDesc* Expr) { ident Ident; SymEntry* Field; + TypeCode Q; /* Skip the token and check for an identifier */ NextToken (); @@ -1104,8 +1105,14 @@ static void StructRef (ExprDesc* Expr) /* Set the struct field offset */ Expr->IVal += Field->V.Offs; - /* The type is now the type of the field */ - Expr->Type = Field->Type; + /* The type is the type of the field plus any qualifiers from the struct */ + Q = GetQualifier (Expr->Type); + if (Q == T_QUAL_NONE) { + Expr->Type = Field->Type; + } else { + Expr->Type = TypeDup (Field->Type); + Expr->Type->C |= Q; + } /* An struct member is actually a variable. So the rules for variables * with respect to the reference type apply: If it's an array, it is -- 2.39.5