Skip to content

Commit

Permalink
Fix issue #365.
Browse files Browse the repository at this point in the history
  • Loading branch information
vnmakarov committed Aug 8, 2023
1 parent 666a9fd commit 86456a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions c-tests/new/issue365.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enum { x } x;
1 change: 1 addition & 0 deletions c-tests/new/issue365.c.expectrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
6 changes: 5 additions & 1 deletion c2mir/c2mir.c
Original file line number Diff line number Diff line change
Expand Up @@ -6402,7 +6402,11 @@ static void def_symbol (c2m_ctx_t c2m_ctx, enum symbol_mode mode, node_t id, nod
return;
}
tab_decl_spec = ((decl_t) sym.def_node->attr)->decl_spec;
if (linkage == N_IGNORE) {
if ((def_node->code == N_ENUM_CONST || sym.def_node->code == N_ENUM_CONST)
&& def_node->code != sym.def_node->code) {
error (c2m_ctx, POS (id), "%s redeclared as a different kind of symbol", id->u.s.s);
return;
} else if (linkage == N_IGNORE) {
if (!decl_spec.typedef_p || !tab_decl_spec.typedef_p
|| !type_eq_p (decl_spec.type, tab_decl_spec.type))
#if defined(__APPLE__)
Expand Down

0 comments on commit 86456a6

Please sign in to comment.