struct S { /*nothing*/; int a; }; is an acceptable struct declaration, there may be stray semicolons in the member list.
Unified · Split
| @@ -3250,7 +3250,10 @@ static void struct_decl(CType *type, AttributeDef *ad, int u) · 3249 unmodified lines | ||
| 3250 | 3250 | offset = 0; |
| 3251 | 3251 | flexible = 0; |
| 3252 | 3252 | while (tok != '}') { |
| 3253 | − parse_btype(&btype, &ad1); | |
| 3253 | + if (!parse_btype(&btype, &ad1)) { | |
| 3254 | + skip(';'); | |
| 3255 | + continue; | |
| 3256 | + } | |
| 3254 | 3257 | while (1) { |
| 3255 | 3258 | extra_bytes = 0; |
| 3256 | 3259 | if (flexible) |
| @@ -642,6 +642,11 @@ union union2 { · 641 unmodified lines | ||
| 642 | 642 | |
| 643 | 643 | struct struct1 st1, st2; |
| 644 | 644 | |
| 645 | +struct empty_mem { | |
| 646 | + /* nothing */ ; | |
| 647 | + int x; | |
| 648 | +}; | |
| 649 | + | |
| 645 | 650 | int main(int argc, char **argv) |
| 646 | 651 | { |
| 647 | 652 | string_test(); |