fixed the "void (*i)(void) = f" case
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 1 Oct 2001 15:48:44 +0000 (15:48 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 1 Oct 2001 15:48:44 +0000 (15:48 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1338 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCicode.c

index 6d1b6b8941b1ef3df76ca1a2fdbef432692d5a94..5755fc38557d06ba07b0db25117ee26e7cd08394 100644 (file)
@@ -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++;
+           }
          }
        }
       }