Fixed function declarator parser when a parameter has a function type.
Ensured check on parameter lists without types in non-definition declarations.
This commit is contained in:
1
test/err/bug2303.c
Normal file
1
test/err/bug2303.c
Normal file
@@ -0,0 +1 @@
|
||||
int f(a); /* Should be an error */
|
||||
32
test/val/bug2302.c
Normal file
32
test/val/bug2302.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Bug #2302 - Parameters of function types not parsed correctly */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef int A;
|
||||
int zoo(A ()); /* OK: int zoo(int (*)()) */
|
||||
int zoo(A (())); /* OK: int zoo(int ((*)())) aka. int zoo(int (*)()) */
|
||||
int zoo(A (A)); /* OK: int zoo(int (*)(int)) */
|
||||
int zoo(A ((A))); /* OK: int zoo(int ((*)(int))) aka. int zoo(int (*)(int)) */
|
||||
int zoo(A A(A)); /* OK: int zoo(int (*A)(int)) */
|
||||
int zoo(A (*)(A)); /* OK: int zoo(int (*)(int)) */
|
||||
int zoo(A (*A)(A)); /* OK: int zoo(int (*A)(int)) */
|
||||
int zoo(A ((*A))(A)); /* OK: int zoo(int (*A)(int)) */
|
||||
int zoo(A ((((*((fp))))(A A)))) /* OK: int zoo(int (*fp)(int A)) */
|
||||
{
|
||||
return fp(42);
|
||||
}
|
||||
|
||||
int bar(int a)
|
||||
{
|
||||
return a ^ 42;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a = zoo((int (*)())bar);
|
||||
if (a != 0)
|
||||
{
|
||||
printf("failed: a = %d\n", a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
Reference in New Issue
Block a user