mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
Allow local redefinition of enumerator
This commit is contained in:
parent
a620b12dc1
commit
3e56584223
2
tccgen.c
2
tccgen.c
@ -2827,7 +2827,7 @@ static void struct_decl(CType *type, int u, int tdef)
|
||||
if (v < TOK_UIDENT)
|
||||
expect("identifier");
|
||||
ss = sym_find(v);
|
||||
if (ss)
|
||||
if (ss && !local_stack)
|
||||
tcc_error("redefinition of enumerator '%s'",
|
||||
get_tok_str(v, NULL));
|
||||
next();
|
||||
|
14
tests/tests2/63_local_enumerator_redefinition.c
Normal file
14
tests/tests2/63_local_enumerator_redefinition.c
Normal file
@ -0,0 +1,14 @@
|
||||
enum {
|
||||
FOO,
|
||||
BAR
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
enum {
|
||||
FOO = 2,
|
||||
BAR
|
||||
};
|
||||
|
||||
return BAR - FOO;
|
||||
}
|
@ -74,7 +74,8 @@ TESTS = \
|
||||
59_function_array.test \
|
||||
60_enum_redefinition.test \
|
||||
61_undefined_enum.test \
|
||||
62_enumerator_redefinition.test
|
||||
62_enumerator_redefinition.test \
|
||||
63_local_enumerator_redefinition.test
|
||||
|
||||
# 30_hanoi.test -- seg fault in the code, gcc as well
|
||||
# 34_array_assignment.test -- array assignment is not in C standard
|
||||
|
Loading…
Reference in New Issue
Block a user