Input: template<int> void a() { struct { void b() const; void b() { [b] } }; }; Output: $ xgcc -x c++ -S input.cc input.cc: In lambda function: input.cc:5:18: internal compiler error: in build_capture_proxy, at cp/lambda.c:460 void b() { [b] } ^ 0xd425db build_capture_proxy /home/vegard/git/gcc/gcc/cp/lambda.c:460 0xd55770 start_lambda_function(tree_node*, tree_node*) /home/vegard/git/gcc/gcc/cp/lambda.c:1377 0xfd1f1d cp_parser_lambda_body /home/vegard/git/gcc/gcc/cp/parser.c:10668 0xfd1f1d cp_parser_lambda_expression /home/vegard/git/gcc/gcc/cp/parser.c:10182 0xf37404 cp_parser_primary_expression /home/vegard/git/gcc/gcc/cp/parser.c:5257 0xf78edb cp_parser_postfix_expression /home/vegard/git/gcc/gcc/cp/parser.c:7026 0xf2cc47 cp_parser_unary_expression /home/vegard/git/gcc/gcc/cp/parser.c:8318 0xec1cba cp_parser_cast_expression /home/vegard/git/gcc/gcc/cp/parser.c:9086 0xec42e6 cp_parser_binary_expression /home/vegard/git/gcc/gcc/cp/parser.c:9187 0xec80ba cp_parser_assignment_expression /home/vegard/git/gcc/gcc/cp/parser.c:9482 0xecc026 cp_parser_expression /home/vegard/git/gcc/gcc/cp/parser.c:9651 0xee05a6 cp_parser_expression_statement /home/vegard/git/gcc/gcc/cp/parser.c:11127 0xefbf30 cp_parser_statement /home/vegard/git/gcc/gcc/cp/parser.c:10931 0xf0043b cp_parser_statement_seq_opt /home/vegard/git/gcc/gcc/cp/parser.c:11270 0xf00eda cp_parser_compound_statement /home/vegard/git/gcc/gcc/cp/parser.c:11224 0xf953eb cp_parser_function_body /home/vegard/git/gcc/gcc/cp/parser.c:21767 0xf953eb cp_parser_ctor_initializer_opt_and_function_body /home/vegard/git/gcc/gcc/cp/parser.c:21802 0xf9e5f5 cp_parser_function_definition_after_declarator /home/vegard/git/gcc/gcc/cp/parser.c:26703 0xfa08bc cp_parser_late_parsing_for_member /home/vegard/git/gcc/gcc/cp/parser.c:27584 0xf19ac5 cp_parser_class_specifier_1 /home/vegard/git/gcc/gcc/cp/parser.c:22731 xgcc --version xgcc (GCC) 8.0.1 20180228 (experimental) This looks potentially similar to bug #84160, but I'm running a more recent version where that bug should be already fixed.
Confirmed. Started with r253265.
Failing here in build_capture_proxy (member=<field_decl 0x7ffff19d57b8 __b>, init=<component_ref 0x7ffff18abb70>) at ../../src/gcc/cp/lambda.c:458: 458 gcc_assert (VAR_P (init) || TREE_CODE (init) == PARM_DECL); where init is a component_ref.
Looking into it.
Author: paolo Date: Mon Mar 5 15:40:15 2018 New Revision: 258250 URL: https://gcc.gnu.org/viewcvs?rev=258250&root=gcc&view=rev Log: /cp 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84618 * parser.c (cp_parser_lambda_introducer): Reject any capture not involving a VAR_DECL or a PARM_DECL. /testsuite 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84618 * g++.dg/cpp0x/lambda/lambda-ice29.C: New. * g++.dg/cpp0x/lambda/lambda-ice17.C: Adjust. * g++.dg/cpp0x/lambda/lambda-ice23.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice29.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice23.C
Fixed.