From c69e2d9f0fa2a1ca606354ad04f4e4dd74ce015a Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 5 Oct 2009 17:49:45 +0000 Subject: [PATCH] Fixed a bug: Function designators are converted to rvalues of type "pointer to function", so dereferencing a function is a legal operation. The result is immediately converted back to "pointer to function" again. Note: Because of performance considerations, cc65 does treat functions as "pointer to function" internally, but nevertheless dereferencing a function must be possible. git-svn-id: svn://svn.cc65.org/cc65/trunk@4330 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- 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 ac7f72dc0..9d8af55d5 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1599,9 +1599,12 @@ void hie10 (ExprDesc* Expr) ED_MakeRValExpr (Expr); } /* If the expression is already a pointer to function, the - * additional dereferencing operator must be ignored. + * additional dereferencing operator must be ignored. A function + * itself is represented as "pointer to function", so any number + * of dereference operators is legal, since the result will + * always be converted to "pointer to function". */ - if (IsTypeFuncPtr (Expr->Type)) { + if (IsTypeFuncPtr (Expr->Type) || IsTypeFunc (Expr->Type)) { /* Expression not storable */ ED_MakeRVal (Expr); } else { -- 2.39.5