Fixed function parameters declared as function types rather than function pointers.

This commit is contained in:
acqn
2022-08-24 15:30:52 +08:00
parent 8605393953
commit 26945c32ac
2 changed files with 39 additions and 4 deletions

35
test/val/bug1838.c Normal file
View File

@@ -0,0 +1,35 @@
/* Bug 1838 - function parameters declared as function types rather than function pointers */
#include <stdio.h>
static int failures = 0;
typedef int fn_t(int);
int main(void)
{
void foo(fn_t*);
fn_t bar;
foo(bar);
return 0;
}
void foo(int func(int))
{
int n = func(42);
if (n != 12) {
printf("n = %d, expected: 12\n", n);
++failures;
}
}
int bar(int a)
{
if (a != 42) {
printf("a = %d, expected: 42\n", a);
++failures;
}
return 12;
}