1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
typedef int (*fun_t)(void*);
int foo(void *a, void *fun)
{
return ((fun_t)fun)(a);
}
int bar(void *a, void *fun)
{
return ((int (*)(void *))fun)(a);
}
int qux(void *a, void *fun)
{
return (*(fun_t)fun)(a);
}
int quz(void *a, void *fun)
{
return (*(int (*)(void *))fun)(a);
}
/*
* check-name: call via casted function pointer
* check-command: test-linearize -Wno-decl $file
*
* check-output-ignore
* check-output-excludes: load
* check-output-pattern(4): ptrcast\\..* %arg2
* check-output-pattern(4): call\\..* %arg1
*/
|