https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80984
Bug ID: 80984 Summary: [5/6/7/8 Regression] ICE with label/variable ambiguity Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: ice-on-valid-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 valid code snippet triggers an ICE since GCC 5.1.0: =================================== struct A { ~A(); }; A foo() { A a; a: return a; } =================================== bug.cc: In function 'A foo()': bug.cc:11:1: internal compiler error: tree check: expected var_decl or parm_decl or result_decl, have label_decl in cp_genericize, at cp/cp-gimplify.c:1594 } ^ 0x1028c1c tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9859 0x66927a tree_check3(tree_node*, char const*, int, char const*, tree_code, tree_code, tree_code) ../../gcc/gcc/tree.h:3123 0x66927a cp_genericize(tree_node*) ../../gcc/gcc/cp/cp-gimplify.c:1594 0x6a6c52 finish_function(int) ../../gcc/gcc/cp/decl.c:15708 0x765e7e cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:26296 0x74f8bd cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:26202 0x74f8bd cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19168 0x76e92c cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:12800 0x76f6c5 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12625 0x741b74 cp_parser_declaration ../../gcc/gcc/cp/parser.c:12523 0x77753b cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:12399 0x77781a cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4364 0x77781a c_parse_file() ../../gcc/gcc/cp/parser.c:38475 0x8b9066 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1104 Please submit a full bug report, [etc.]