https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85227
Bug ID: 85227 Summary: ICE with structured binding of a forward declared variable 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 invalid code snippet (compiled with "-std=c++17") triggers an ICE since GCC 7.1.0 (when structured bindings were introduced): =============================== extern struct A a; template<int> void foo() { auto[i] = a; } =============================== bug.cc: In function 'void foo()': bug.cc:5:13: internal compiler error: Segmentation fault auto[i] = a; ^ 0xebd2ff crash_signal ../../gcc/gcc/toplev.c:325 0x881861 tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc/gcc/tree.h:3134 0x881861 find_decomp_class_base ../../gcc/gcc/cp/decl.c:7344 0x8a3ec4 cp_finish_decomp(tree_node*, tree_node*, unsigned int) ../../gcc/gcc/cp/decl.c:7733 0x944963 cp_parser_decomposition_declaration ../../gcc/gcc/cp/parser.c:13336 0x944963 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:12979 0x945318 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12874 0x945d49 cp_parser_declaration_statement ../../gcc/gcc/cp/parser.c:12468 0x9241c3 cp_parser_statement ../../gcc/gcc/cp/parser.c:10917 0x925130 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:11266 0x925207 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:11220 0x93bde0 cp_parser_function_body ../../gcc/gcc/cp/parser.c:21781 0x93bde0 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:21818 0x93c690 cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:26839 0x93d416 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:26755 0x93d416 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19501 0x94362a cp_parser_single_declaration ../../gcc/gcc/cp/parser.c:27295 0x94376c cp_parser_template_declaration_after_parameters ../../gcc/gcc/cp/parser.c:26897 0x94402c cp_parser_explicit_template_declaration ../../gcc/gcc/cp/parser.c:27134 0x94402c cp_parser_template_declaration_after_export ../../gcc/gcc/cp/parser.c:27153 Please submit a full bug report, [etc.]