struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-1918.c
blobe52194d2d97e172cffda43846b252d9b7010b7b8
1 /*
2 * bug-1918.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 int run_func0 (int (*f) (int), int d);
9 int run_func1 (int (*) (int), int);
11 int test_func (int x)
13 return x > 0 ? x + 1 : x - 1;
16 int run_func0 (int (*f) (int), int d)
18 return f(d) + 10;
21 int run_func1 (int (*f) (int), int d)
23 return f(d) - 10;
25 #endif
27 void testBug (void)
29 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
30 ASSERT (run_func0 (test_func, 23) == 34);
31 ASSERT (run_func1 (test_func, -23) == -34);
32 #endif