From 9198b3be00168d148000a501b4270c39b8fdf598 Mon Sep 17 00:00:00 2001 From: acqn <acqn163@outlook.com> Date: Fri, 17 Jul 2020 15:10:27 +0800 Subject: [PATCH] Fixed '&function' and '&array'. --- src/cc65/expr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index d3b5255d8..79650109f 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1841,9 +1841,12 @@ void hie10 (ExprDesc* Expr) /* Do it anyway, just to avoid further warnings */ Expr->Flags &= ~E_BITFIELD; } + /* It's allowed in C to take the address of an array this way */ + if (!IsTypeFunc (Expr->Type) && !IsTypeArray (Expr->Type)) { + /* The & operator yields an rvalue address */ + ED_AddrExpr (Expr); + } Expr->Type = PointerTo (Expr->Type); - /* The & operator yields an rvalue address */ - ED_AddrExpr (Expr); } break;