1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-28 10:55:43 +00:00

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
This commit is contained in:
uz 2009-10-05 17:37:45 +00:00
parent 8348f62114
commit 43c89d5fd0

View File

@ -1070,6 +1070,7 @@ static void StructRef (ExprDesc* Expr)
{ {
ident Ident; ident Ident;
SymEntry* Field; SymEntry* Field;
TypeCode Q;
/* Skip the token and check for an identifier */ /* Skip the token and check for an identifier */
NextToken (); NextToken ();
@ -1104,8 +1105,14 @@ static void StructRef (ExprDesc* Expr)
/* Set the struct field offset */ /* Set the struct field offset */
Expr->IVal += Field->V.Offs; Expr->IVal += Field->V.Offs;
/* The type is now the type of the field */ /* 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; 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 /* 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 * with respect to the reference type apply: If it's an array, it is