diff --git a/src/cc65/assignment.c b/src/cc65/assignment.c index 6e25eaa56..0151a9000 100644 --- a/src/cc65/assignment.c +++ b/src/cc65/assignment.c @@ -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; diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 817234ec8..f75015305 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -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);