https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84533
Bug ID: 84533 Summary: [7/8 Regression] ICE with duplicate enum value Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org Target Milestone: --- The following really short invalid code snippet (compiled with "-std=c++1z") triggers an ICE since GCC 7.1.0: ====================== enum E { e, e }; ====================== bug.cc:1:13: internal compiler error: tree check: expected var_decl or function_decl, have const_decl in redeclaration_error_message, at cp/decl.c:2923 enum E { e, e }; ^ 0x78a6fc tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9335 0x890e85 tree_check2(tree_node*, char const*, int, char const*, tree_code, tree_code) ../../gcc/gcc/tree.h:3151 0x890e85 redeclaration_error_message ../../gcc/gcc/cp/decl.c:2923 0x890e85 duplicate_decls(tree_node*, tree_node*, bool) ../../gcc/gcc/cp/decl.c:1767 0x9007ea do_pushdecl ../../gcc/gcc/cp/name-lookup.c:3035 0x9007ea pushdecl(tree_node*, bool) ../../gcc/gcc/cp/name-lookup.c:3170 0x8935d9 build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*, unsigned int) ../../gcc/gcc/cp/decl.c:14644 0x929db7 cp_parser_enumerator_definition ../../gcc/gcc/cp/parser.c:18410 0x929db7 cp_parser_enumerator_list ../../gcc/gcc/cp/parser.c:18339 0x929db7 cp_parser_enum_specifier ../../gcc/gcc/cp/parser.c:18266 0x929db7 cp_parser_type_specifier ../../gcc/gcc/cp/parser.c:16726 0x936966 cp_parser_decl_specifier_seq ../../gcc/gcc/cp/parser.c:13612 0x93c030 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:12922 0x93cfd8 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12869 0x940f32 cp_parser_declaration ../../gcc/gcc/cp/parser.c:12767 0x941341 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:12643 0x941634 cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4559 0x941634 c_parse_file() ../../gcc/gcc/cp/parser.c:38866 0xa3f966 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1132 Please submit a full bug report, [etc.]