From: Paolo Carlini Date: Sun, 11 Dec 2016 18:15:31 +0000 (+0000) Subject: re PR c++/78637 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error... X-Git-Tag: basepoints/gcc-8~2397 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1f7d967aa8425806836bdf291cacecb8a636df0;p=thirdparty%2Fgcc.git re PR c++/78637 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in pop_namespace, at cp/name-lookup.c:3826)) /cp 2016-12-11 Paolo Carlini PR c++/78637 * parser.c (cp_parser_namespace_definition): Increment nested_definition_count only if push_namespace succeeds. /testsuite 2016-12-11 Paolo Carlini PR c++/78637 * g++.dg/parse/namespace14.C: New. From-SVN: r243529 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4b203b2a7940..56803bf77484 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-12-11 Paolo Carlini + + PR c++/78637 + * parser.c (cp_parser_namespace_definition): Increment + nested_definition_count only if push_namespace succeeds. + 2016-12-08 Nathan Sidwell PR c++/78551 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 70e5fb33f7c9..8ed75c70daa6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18184,8 +18184,8 @@ cp_parser_namespace_definition (cp_parser* parser) cp_parser_error (parser, "nested identifier required"); break; } - ++nested_definition_count; - push_namespace (identifier); + if (push_namespace (identifier)) + ++nested_definition_count; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9bd73899c979..8603a02aa8be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-11 Paolo Carlini + + PR c++/78637 + * g++.dg/parse/namespace14.C: New. + 2016-12-10 Jakub Jelinek PR tree-optimization/78720 diff --git a/gcc/testsuite/g++.dg/parse/namespace14.C b/gcc/testsuite/g++.dg/parse/namespace14.C new file mode 100644 index 000000000000..a6fa69b38274 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/namespace14.C @@ -0,0 +1,6 @@ +// PR c++/78637 + +namespace X { +class Y; +} +namespace X::Y z; // { dg-error "namespace|expected|type" }