struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2834.c
blob5d03606d1914ccdd3f5e4e80b6bbcaba9dcc98d8
1 /* bug-2834.c
2 A bug in union initialization.
3 */
5 #include <testfwk.h>
7 union u
9 int i;
10 int j;
13 _Bool check(union u *u)
15 return (u->i == 23);
18 void testBug1(void)
20 union u u = {23};
21 ASSERT (check(&u));
24 void testBug2(void)
26 union u u = {.i = 23};
27 ASSERT (check(&u));
30 void testBug3(void)
32 union u u = {.j = 23};
33 ASSERT (check(&u));