]> git.sur5r.net Git - cc65/commitdiff
Catch fastcall pointers to variadic functions.
authorGreg King <gregdk@users.sf.net>
Fri, 13 Mar 2015 16:18:43 +0000 (12:18 -0400)
committerGreg King <gregdk@users.sf.net>
Fri, 13 Mar 2015 16:18:43 +0000 (12:18 -0400)
src/cc65/declare.c

index e6417c6a819937f83babf8b34c8b56f3d3e72b7c..4fab3ea0a23aa6832dafbca96c593daa5f827b15 100644 (file)
@@ -353,8 +353,12 @@ static void FixQualifiers (Type* DataType)
                             Error ("Mismatch between pointer's and function's calling conventions");
                         }
                     } else {
-                        /* Move the qualifier from the pointer to the function. */
-                        T[1].C |= Q;
+                        if (Q == T_QUAL_FASTCALL && IsVariadicFunc (T + 1)) {
+                            Error ("Variadic-function pointers cannot be `__fastcall__'");
+                        } else {
+                            /* Move the qualifier from the pointer to the function. */
+                            T[1].C |= Q;
+                        }
                     }
                 } else {
                     Error ("Not pointer to a function; can't use a calling convention");