From ce931b85be8c41d30510685c6b92fbe74e12aec9 Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 24 Nov 2009 23:02:58 +0000 Subject: [PATCH] In case of parse errors for structs, don't just set the type of the result to "int", return a valid lvalue instead. git-svn-id: svn://svn.cc65.org/cc65/trunk@4483 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 27a8469a5..fdf18c4d6 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1097,7 +1097,8 @@ static void StructRef (ExprDesc* Expr) NextToken (); if (CurTok.Tok != TOK_IDENT) { Error ("Identifier expected"); - Expr->Type = type_int; + /* Make the expression an integer at address zero */ + ED_MakeConstAbs (Expr, 0, type_int); return; } @@ -1107,7 +1108,8 @@ static void StructRef (ExprDesc* Expr) Field = FindStructField (Expr->Type, Ident); if (Field == 0) { Error ("Struct/union has no field named `%s'", Ident); - Expr->Type = type_int; + /* Make the expression an integer at address zero */ + ED_MakeConstAbs (Expr, 0, type_int); return; } -- 2.39.5