From: Paolo Carlini Date: Tue, 20 Feb 2018 09:02:12 +0000 (+0000) Subject: re PR c++/84446 (ICE with broken lambda) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b2513e292a70d715affbe4a9b5af6672fcf99b3;p=gcc.git re PR c++/84446 (ICE with broken lambda) /cp 2018-02-20 Paolo Carlini PR c++/84446 * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope on error_mark_node. /testsuite 2018-02-20 Paolo Carlini PR c++/84446 * g++.dg/cpp0x/lambda/lambda-ice27.C: New. From-SVN: r257841 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1e0f9eb321f..f2bcce9784e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-20 Paolo Carlini + + PR c++/84446 + * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope + on error_mark_node. + 2018-02-20 Jakub Jelinek PR c++/84445 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d8d788052ab..2bb0d2da5fe 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -19650,12 +19650,12 @@ cp_parser_init_declarator (cp_parser* parser, member templates. The former involves deferring parsing of the initializer until end of class as with default arguments. So right here we only handle the latter. */ - if (!member_p && processing_template_decl) + if (!member_p && processing_template_decl && decl != error_mark_node) start_lambda_scope (decl); initializer = cp_parser_initializer (parser, &is_direct_init, &is_non_constant_init); - if (!member_p && processing_template_decl) + if (!member_p && processing_template_decl && decl != error_mark_node) finish_lambda_scope (); if (initializer == error_mark_node) cp_parser_skip_to_end_of_statement (parser); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 29157ac3c24..6a0c3bdcb55 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-20 Paolo Carlini + + PR c++/84446 + * g++.dg/cpp0x/lambda/lambda-ice27.C: New. + 2018-02-20 Jakub Jelinek PR c++/84445 diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice27.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice27.C new file mode 100644 index 00000000000..04c44a3b57f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice27.C @@ -0,0 +1,8 @@ +// PR c++/84446 +// { dg-do compile { target c++11 } } + +template void foo() +{ + int i, + i = [] { virtual }(); // { dg-error "redeclaration|expected" } +}