From: Patrick Palka Date: Mon, 19 Sep 2016 18:12:36 +0000 (+0000) Subject: Fix PR c++/77639 (ICE during error recovery) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6101a7ab878f784558c908d6e4773d49b0858e0e;p=gcc.git Fix PR c++/77639 (ICE during error recovery) gcc/cp/ChangeLog: PR c++/77639 * parser.c (cp_parser_class_head): When processing_template_parmlist, don't assume that the class-head may start an explicit specialization. gcc/testsuite/ChangeLog: PR c++/77639 * g++.dg/template/error-recovery4.C: New test. From-SVN: r240245 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9d74bdbb8ba..e4bd392e953 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2016-09-16 Patrick Palka + + PR c++/77639 + * parser.c (cp_parser_class_head): When + processing_template_parmlist, don't assume that the + class-head may start an explicit specialization. + 2016-09-16 Jakub Jelinek PR c++/77482 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fb88021e237..c03b9c2e5e3 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22025,6 +22025,7 @@ cp_parser_class_head (cp_parser* parser, it is not, try to recover gracefully. */ if (at_namespace_scope_p () && parser->num_template_parameter_lists == 0 + && !processing_template_parmlist && template_id_p) { /* Build a location of this form: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68d3973dcde..f7d00480743 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-19 Patrick Palka + + PR c++/77639 + * g++.dg/template/error-recovery4.C: New test. + 2016-09-19 Bin Cheng * gcc.dg/vect/pr57558-1.c: Use unsigned int instead of unsigned long. diff --git a/gcc/testsuite/g++.dg/template/error-recovery4.C b/gcc/testsuite/g++.dg/template/error-recovery4.C new file mode 100644 index 00000000000..1e52c6a6b3e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error-recovery4.C @@ -0,0 +1,5 @@ +// PR c++/77639 + +template struct B {}; +template {}; // { dg-error "" } +B i;