https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84585
Bug ID: 84585 Summary: internal compiler error: in get_local_decls, at cp/name-lookup.c:3654 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 Target Milestone: --- This (invalid) program: template <typename a> b() {[](auto = template <;{a c(auto When compiled with: xgcc -x c++ -std=c++14 -O3 -c - Gives this output: <stdin>:1:25: error: ISO C++ forbids declaration of 'b' with no type [-fpermissive] <stdin>: In function 'int b()': <stdin>:1:38: error: a template declaration cannot appear at block scope <stdin>:1:49: error: expected ')' before '{' token <stdin>: In lambda function: <stdin>:1:54: internal compiler error: in get_local_decls, at cp/name-lookup.c:3654 0xe15de7 get_local_decls() /home/vegard/git/gcc/gcc/cp/name-lookup.c:3653 0xe8421c synthesize_implicit_template_parm /home/vegard/git/gcc/gcc/cp/parser.c:39013 0xf2b5cd cp_parser_simple_type_specifier /home/vegard/git/gcc/gcc/cp/parser.c:16966 0xf1f5ad cp_parser_type_specifier /home/vegard/git/gcc/gcc/cp/parser.c:16786 0xf8520a cp_parser_decl_specifier_seq /home/vegard/git/gcc/gcc/cp/parser.c:13573 0xfb3e8d cp_parser_parameter_declaration /home/vegard/git/gcc/gcc/cp/parser.c:21440 0xfb67da cp_parser_parameter_declaration_list /home/vegard/git/gcc/gcc/cp/parser.c:21252 0xfb9470 cp_parser_parameter_declaration_clause /home/vegard/git/gcc/gcc/cp/parser.c:21173 0xf555ef cp_parser_direct_declarator /home/vegard/git/gcc/gcc/cp/parser.c:19926 0xf9b858 cp_parser_declarator /home/vegard/git/gcc/gcc/cp/parser.c:19800 0xf9bb2e cp_parser_init_declarator /home/vegard/git/gcc/gcc/cp/parser.c:19326 0xfa2a97 cp_parser_simple_declaration /home/vegard/git/gcc/gcc/cp/parser.c:13009 0xfa8c88 cp_parser_block_declaration /home/vegard/git/gcc/gcc/cp/parser.c:12827 0xfab154 cp_parser_declaration_statement /home/vegard/git/gcc/gcc/cp/parser.c:12420 0xef6e13 cp_parser_statement /home/vegard/git/gcc/gcc/cp/parser.c:10869 0xefb1eb cp_parser_statement_seq_opt /home/vegard/git/gcc/gcc/cp/parser.c:11218 0xfcca31 cp_parser_lambda_body /home/vegard/git/gcc/gcc/cp/parser.c:10632 0xfcca31 cp_parser_lambda_expression /home/vegard/git/gcc/gcc/cp/parser.c:10137 0xf31764 cp_parser_primary_expression /home/vegard/git/gcc/gcc/cp/parser.c:5257 0xf7373b cp_parser_postfix_expression /home/vegard/git/gcc/gcc/cp/parser.c:7026 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Version: xgcc (GCC) 8.0.1 20180204 (experimental) built from git fdae6180ad24fa6303fa046114f3e4b66b8db34d Versions 5.4.1 and 7.3.0 don't seem to be affected AFAICS. Test case was reduced using C-Reduce. I've also submitted bug #84576 which could be related.