From dd6f1e0cb6d1d53fa339f386867eaec876b51114 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:26:46 +0100 Subject: [PATCH] Fix const cast of functions to void * in struct inits --- autotest/structarraycopy.c | 2 +- oscar64/Declaration.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/autotest/structarraycopy.c b/autotest/structarraycopy.c index 6965d3c..675ed98 100644 --- a/autotest/structarraycopy.c +++ b/autotest/structarraycopy.c @@ -10,7 +10,7 @@ Point tcorners[8], pcorners[8]; int bm_line(void) { - + return 0; } void drawCube(void) diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index 0cefcc4..0841cc4 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -276,6 +276,13 @@ Expression* Expression::ConstantFold(Errors * errors) ex->mDecType = mLeft->mDecType; return ex; } + else if (mRight->mDecValue->mType == DT_CONST_FUNCTION) + { + Expression* ex = new Expression(mLocation, EX_CONSTANT); + ex->mDecValue = mRight->mDecValue; + ex->mDecType = mLeft->mDecType; + return ex; + } } else if (mLeft->mDecType->mType == DT_TYPE_INTEGER) {