struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2271.c
blob3992b7f2749ea2821765355c6486c42c6ed44c5c
1 /*
2 bug-2271.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 extern int foo0 (int *[]);
9 extern int foo1 (int (*[])(int), int, int);
11 int a = 56;
12 int b = 33;
13 int *p[2] = {&a, &b};
15 int foo0 (int *p[])
17 return *p[0] + *p[1];
20 int f0 (int a)
22 return a + 1;
25 int f1 (int b)
27 return b << 1;
30 int (*pf[2])(int) = {f0, f1};
32 int foo1 (int (*pf[])(int), int a, int b)
34 return pf[0](a) + pf[1](b);
36 #endif
38 void testBug (void)
40 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
41 ASSERT (foo0 (p) == 89);
42 ASSERT (foo1 (pf, 4, 8) == 21);
43 #endif