https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101878
Bug ID: 101878 Summary: ICE with invalid lambda definition Product: gcc Version: 12.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 code snippet triggers an ICE since GCC 4.9.0 (where generic lambdas were introduced): =========================== void foo() { [](auto) [ []{}; ]; } =========================== bug.cc: In function 'void foo()': bug.cc:3:16: error: expected ']' before '{' token 3 | [](auto) [ []{}; ]; | ^ | ] bug.cc:3:17: internal compiler error: in dependent_type_p, at cp/pt.c:26774 3 | [](auto) [ []{}; ]; | ^ 0x6e03a4 dependent_type_p(tree_node*) ../../gcc/gcc/cp/pt.c:26774 0x9b9fcf require_complete_types_for_parms ../../gcc/gcc/cp/decl.c:14232 0x9b9fcf check_function_type ../../gcc/gcc/cp/decl.c:16449 0x9b9fcf start_preparsed_function(tree_node*, tree_node*, int) ../../gcc/gcc/cp/decl.c:16648 0xa17325 start_lambda_function(tree_node*, tree_node*) ../../gcc/gcc/cp/lambda.c:1428 0xaa4ad9 cp_parser_lambda_body ../../gcc/gcc/cp/parser.c:11637 0xaa4ad9 cp_parser_lambda_expression ../../gcc/gcc/cp/parser.c:10965 0xaa5593 cp_parser_primary_expression ../../gcc/gcc/cp/parser.c:5666 0xaa82ed cp_parser_postfix_expression ../../gcc/gcc/cp/parser.c:7563 0xa91a2a cp_parser_binary_expression ../../gcc/gcc/cp/parser.c:9893 0xa9233c cp_parser_assignment_expression ../../gcc/gcc/cp/parser.c:10197 0xa938b2 cp_parser_expression ../../gcc/gcc/cp/parser.c:10367 0xa96f58 cp_parser_expression_statement ../../gcc/gcc/cp/parser.c:12531 0xaa2dff cp_parser_statement ../../gcc/gcc/cp/parser.c:12327 0xaa3e9d cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:12679 0xaa3f78 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:12628 0xac35c0 cp_parser_function_body ../../gcc/gcc/cp/parser.c:24762 0xac35c0 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:24813 0xac428a cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:30898 0xac56c4 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:30814 Please submit a full bug report, [etc.]