History

Report error when redefining enumerator

Prevent the following code from compiling: enum color {RED, GREEN, BLUE}; enum rgb {RED, G, B};

Thomas Preud'homme committed 13 years ago

Commit 673befd1 parent 82969f01 file · +4 −0Browse files

Unified · Split

tccgen.c+4−0
@@ -2786,6 +2786,10 @@ static void struct_decl(CType *type, int u, int tdef) · 2785 unmodified lines
2786 v = tok;2786 v = tok;
2787 if (v < TOK_UIDENT)2787 if (v < TOK_UIDENT)
2788 expect("identifier");2788 expect("identifier");
2789 ss = sym_find(v);
2790 if (ss)
2791 tcc_error("redefinition of enumerator '%s'",
2792 get_tok_str(v, NULL));
2789 next();2793 next();
2790 if (tok == '=') {2794 if (tok == '=') {
2791 next();2795 next();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t