forked from Mirrors/tinycc
Report error when redefining enumerator
Prevent the following code from compiling: enum color {RED, GREEN, BLUE}; enum rgb {RED, G, B};master
parent
82969f045c
commit
673befd2d7
4
tccgen.c
4
tccgen.c
|
@ -2786,6 +2786,10 @@ static void struct_decl(CType *type, int u, int tdef)
|
||||||
v = tok;
|
v = tok;
|
||||||
if (v < TOK_UIDENT)
|
if (v < TOK_UIDENT)
|
||||||
expect("identifier");
|
expect("identifier");
|
||||||
|
ss = sym_find(v);
|
||||||
|
if (ss)
|
||||||
|
tcc_error("redefinition of enumerator '%s'",
|
||||||
|
get_tok_str(v, NULL));
|
||||||
next();
|
next();
|
||||||
if (tok == '=') {
|
if (tok == '=') {
|
||||||
next();
|
next();
|
||||||
|
|
Loading…
Reference in New Issue