https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84518
Bug ID: 84518 Summary: [8 Regression] ICE with lambda capturing broken variable Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: error-recovery, 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 testcase triggers an ICE on trunk: ============================ template<int> void foo() { int x[=]; [&x]{}; } void bar() { foo<0>(); } ============================ bug.cc: In function 'void foo()': bug.cc:3:9: error: expected primary-expression before '=' token int x[=]; ^ bug.cc:3:10: error: expected primary-expression before ']' token int x[=]; ^ bug.cc: In instantiation of 'void foo() [with int <anonymous> = 0]': bug.cc:9:10: required from here bug.cc:4:3: internal compiler error: tree check: expected class 'expression', have 'exceptional' (error_mark) in tree_operand_check, at tree.h:3630 [&x]{}; ^ 0x78a846 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9385 0x614d34 expr_check(tree_node*, char const*, int, char const*) ../../gcc/gcc/tree.h:3301 0x614d34 tree_operand_check(tree_node*, int, char const*, int, char const*) ../../gcc/gcc/tree.h:3630 0x614d34 build_capture_proxy(tree_node*, tree_node*) ../../gcc/gcc/cp/lambda.c:447 0x8d8596 start_lambda_function(tree_node*, tree_node*) ../../gcc/gcc/cp/lambda.c:1374 0x95a004 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:17080 0x95a9e2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:18368 0x969349 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17130 0x969349 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16862 0x968ce0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16079 0x9683c9 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16065 0x966481 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16346 0x965718 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16050 0x965718 instantiate_decl(tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:23406 0x98b7ab instantiate_pending_templates(int) ../../gcc/gcc/cp/pt.c:23522 0x8b1cab c_parse_final_cleanups() ../../gcc/gcc/cp/decl2.c:4720 Please submit a full bug report, [etc.] The regression was introduced between 2017-09-26 and 2017-10-07.