1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 02:29:32 +00:00

Merge pull request #1182 from acqn/StructPtrField

[cc65] Fixed testing 'struct->field'
This commit is contained in:
Bob Andrews 2020-08-14 14:13:39 +02:00 committed by GitHub
commit 83452ae6b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);