From: johanknol Date: Mon, 1 Oct 2001 15:48:44 +0000 (+0000) Subject: fixed the "void (*i)(void) = f" case X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=50655203be336ea77df225a171227e0c0a3669d9;p=fw%2Fsdcc fixed the "void (*i)(void) = f" case git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1338 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 6d1b6b89..5755fc38 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -1619,17 +1619,20 @@ geniCodeCast (sym_link * type, operand * op, bool implicit) } else { // shouldn't do that with float, array or structure unless to void if (!IS_VOID(getSpec(type)) && - !(IS_CODEPTR(type) && IS_FUNC(optype))) { + !(IS_CODEPTR(type) && IS_FUNC(type->next) && IS_FUNC(optype))) { werror(E_INCOMPAT_TYPES); errors++; } } } else { // from a pointer to a pointer if (!TARGET_IS_Z80 && !TARGET_IS_GBZ80) { - if (implicit) { // if not to generic, they have to match - if ((!IS_GENPTR(type) && (DCL_TYPE(optype) != DCL_TYPE(type)))) { - werror(E_INCOMPAT_PTYPES); - errors++; + // if not a pointer to a function + if (!(IS_CODEPTR(type) && IS_FUNC(type->next) && IS_FUNC(optype))) { + if (implicit) { // if not to generic, they have to match + if ((!IS_GENPTR(type) && (DCL_TYPE(optype) != DCL_TYPE(type)))) { + werror(E_INCOMPAT_PTYPES); + errors++; + } } } }