File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,13 @@ static void gen_addr(Node *node) {
167167 return ;
168168 }
169169 break ;
170+ case ND_ASSIGN :
171+ case ND_COND :
172+ if (node -> ty -> kind == TY_STRUCT || node -> ty -> kind == TY_UNION ) {
173+ gen_expr (node );
174+ return ;
175+ }
176+ break ;
170177 case ND_VLA_PTR :
171178 println (" lea %d(%%rbp), %%rax" , node -> var -> offset );
172179 return ;
Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ int main() {
5757 ASSERT (1 , ({ struct T { struct T * next ; int x ; } a ; struct T b ; b .x = 1 ; a .next = & b ; a .next -> x ; }));
5858 ASSERT (4 , ({ typedef struct T T ; struct T { int x ; }; sizeof (T ); }));
5959
60+ ASSERT (2 , ({ struct {int a ;} x = {1 }, y = {2 }; (x = y ).a ; }));
61+ ASSERT (1 , ({ struct {int a ;} x = {1 }, y = {2 }; (1 ?x :y ).a ; }));
62+ ASSERT (2 , ({ struct {int a ;} x = {1 }, y = {2 }; (0 ?x :y ).a ; }));
63+
6064 printf ("OK\n" );
6165 return 0 ;
6266}
You can’t perform that action at this time.
0 commit comments