struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2646174.c
blob4851a7bad76cce96fde288be3db711acc779f647
1 /*
2 bug-2646174.c
3 */
5 #include <testfwk.h>
7 #include <string.h>
9 struct foo1
11 int x;
12 int y;
15 struct foo2
17 struct foo1 base_position;
18 struct foo1 direction;
21 void
22 f(struct foo1 *a, const struct foo2 *d)
24 memcpy(a, &(d->direction), sizeof(struct foo1));
27 void
28 test_2646174(void)
30 struct foo2 x;
31 struct foo1 y;
32 y.x = 0;
33 x.direction.x = 1;
34 f(&y, &x);
35 ASSERT( y.x == 1 );