1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Fixed testing 'struct->field'.

This commit is contained in:
acqn 2020-08-14 08:32:22 +08:00
parent 0fa18886c0
commit 0dfe9ff5fe
2 changed files with 10 additions and 1 deletions

View File

@ -77,7 +77,7 @@ static int CopyStruct (ExprDesc* LExpr, ExprDesc* RExpr)
/* Get the expression on the right of the '=' */
hie1 (RExpr);
/* Check for equality of the structs */
/* Check for equality of the structs/unions */
if (TypeCmp (ltype, RExpr->Type) < TC_STRICT_COMPATIBLE) {
TypeCompatibilityDiagnostic (ltype, RExpr->Type, 1,
"Incompatible types in assignment to '%s' from '%s'");
@ -114,6 +114,12 @@ static int CopyStruct (ExprDesc* LExpr, ExprDesc* RExpr)
/* Restore the indirection level of lhs */
ED_IndExpr (LExpr);
/* Clear the tested flag set during loading. This is not neccessary
** currently (and probably ever) as a struct/union cannot be converted
** to a boolean in C, but there is no harm to be future-proof.
*/
ED_MarkAsUntested (LExpr);
}
return 1;

View File

@ -1301,6 +1301,9 @@ static void StructRef (ExprDesc* Expr)
LoadExpr (CF_NONE, Expr);
}
/* Clear the tested flag set during loading */
ED_MarkAsUntested (Expr);
/* The type is the field type plus any qualifiers from the struct/union */
if (IsClassStruct (Expr->Type)) {
Q = GetQualifier (Expr->Type);