https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84708
Bug ID: 84708 Summary: internal compiler error: in lambda_expr_this_capture, at cp/lambda.c:772 Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vegard.nossum at gmail dot com CC: webrown.cpp at gmail dot com Target Milestone: --- Input: int y; void a() { struct { int b = ([] { decltype(b) x = y; return y; }) (); } z; } Output: $ xgcc -x c++ -S - <stdin>: In lambda function: <stdin>:6:16: internal compiler error: in lambda_expr_this_capture, at cp/lambda.c:772 0xd491ff lambda_expr_this_capture(tree_node*, bool) /home/vegard/git/gcc/gcc/cp/lambda.c:770 0xd4980c maybe_resolve_dummy(tree_node*, bool) /home/vegard/git/gcc/gcc/cp/lambda.c:879 0x12acfc9 finish_non_static_data_member(tree_node*, tree_node*, tree_node*) /home/vegard/git/gcc/gcc/cp/semantics.c:1788 0x12b23d2 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) /home/vegard/git/gcc/gcc/cp/semantics.c:3719 0xf7f285 cp_parser_decltype_expr /home/vegard/git/gcc/gcc/cp/parser.c:13999 0xf7f285 cp_parser_decltype /home/vegard/git/gcc/gcc/cp/parser.c:14133 0xf31fa7 cp_parser_simple_type_specifier /home/vegard/git/gcc/gcc/cp/parser.c:17063 0xf26f2d cp_parser_type_specifier /home/vegard/git/gcc/gcc/cp/parser.c:16850 0xf8c7ba cp_parser_decl_specifier_seq /home/vegard/git/gcc/gcc/cp/parser.c:13627 0xfa7ca0 cp_parser_simple_declaration /home/vegard/git/gcc/gcc/cp/parser.c:12936 0xfafbc8 cp_parser_block_declaration /home/vegard/git/gcc/gcc/cp/parser.c:12881 0xfb2094 cp_parser_declaration_statement /home/vegard/git/gcc/gcc/cp/parser.c:12474 0xefef9b cp_parser_statement /home/vegard/git/gcc/gcc/cp/parser.c:10923 0xf02a5b cp_parser_statement_seq_opt /home/vegard/git/gcc/gcc/cp/parser.c:11272 0xfd3951 cp_parser_lambda_body /home/vegard/git/gcc/gcc/cp/parser.c:10683 0xfd3951 cp_parser_lambda_expression /home/vegard/git/gcc/gcc/cp/parser.c:10184 0xf390e4 cp_parser_primary_expression /home/vegard/git/gcc/gcc/cp/parser.c:5259 0xf7abbb cp_parser_postfix_expression /home/vegard/git/gcc/gcc/cp/parser.c:7028 0xf2e927 cp_parser_unary_expression /home/vegard/git/gcc/gcc/cp/parser.c:8320 0xec435a cp_parser_cast_expression /home/vegard/git/gcc/gcc/cp/parser.c:9088 $ xgcc --version xgcc (GCC) 8.0.1 20180303 (experimental) Built from git 0d86c284d085d29782d862600a79aa1ff0ee0c47 (r258221). I'm not sure if it's really valid code or not, but clang (with -std=c++11) compiles the test case without any errors. Test case was minimised by C-Reduce. Looks related (identical?) to bug #79651 and bug #83268, but the test case looks smaller in any case.