struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2497.c
blob987dcd3a67ab8f2e353f93b813f5d289f1d8a3bf
1 /*
2 bug-2497.c
3 */
5 #include <testfwk.h>
7 #if !defined( __SDCC_pdk14) && !defined( __SDCC_pdk15) // pdk needs function pointer to be reentrant even for a single argument
8 typedef int func_t (int a);
9 typedef int (*func_p_t)(int a);
11 int fa (int a)
13 return a + 1;
16 int fb (int b)
18 return b + 10;
21 func_t *pa[2] = {fa, fb};
22 func_p_t pb[2] = {fb, fa};
23 #endif
25 void testBug (void)
27 #if !defined( __SDCC_pdk14) && !defined( __SDCC_pdk15)
28 ASSERT (pa[0](5) == 6);
29 ASSERT (pa[1](5) == 15);
30 ASSERT (pb[0](15) == 25);
31 ASSERT (pb[1](15) == 16);
32 #endif