Unified · Split
| @@ -2827,7 +2827,7 @@ static void struct_decl(CType *type, int u, int tdef) · 2826 unmodified lines | ||
| 2827 | 2827 | if (v < TOK_UIDENT) |
| 2828 | 2828 | expect("identifier"); |
| 2829 | 2829 | ss = sym_find(v); |
| 2830 | − if (ss) | |
| 2830 | + if (ss && !local_stack) | |
| 2831 | 2831 | tcc_error("redefinition of enumerator '%s'", |
| 2832 | 2832 | get_tok_str(v, NULL)); |
| 2833 | 2833 | next(); |
| @@ -0,0 +1,14 @@ | ||
| 1 | +enum { | |
| 2 | + FOO, | |
| 3 | + BAR | |
| 4 | +}; | |
| 5 | + | |
| 6 | +int main(void) | |
| 7 | +{ | |
| 8 | + enum { | |
| 9 | + FOO = 2, | |
| 10 | + BAR | |
| 11 | + }; | |
| 12 | + | |
| 13 | + return BAR - FOO; | |
| 14 | +} | |
Empty file added.
| @@ -74,7 +74,8 @@ TESTS = \ · 73 unmodified lines | ||
| 74 | 74 | 59_function_array.test \ |
| 75 | 75 | 60_enum_redefinition.test \ |
| 76 | 76 | 61_undefined_enum.test \ |
| 77 | − 62_enumerator_redefinition.test | |
| 77 | + 62_enumerator_redefinition.test \ | |
| 78 | + 63_local_enumerator_redefinition.test | |
| 78 | 79 | |
| 79 | 80 | # 30_hanoi.test -- seg fault in the code, gcc as well |
| 80 | 81 | # 34_array_assignment.test -- array assignment is not in C standard |