From b41cf3293131e825f2d25e7b4e76ed01b8a28027 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Sat, 29 Jan 2005 02:07:18 +0000 Subject: [PATCH] PR c++/19253 * parser.c (cp_parser_diagnose_invalid_type_name): Commit to tentative parses. PR c++/19253 * g++.dg/template/crash33.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94403 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/parser.c | 6 +++++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/template/crash33.C | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/crash33.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 077113c61de..dbb8551f72c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2005-01-28 Mark Mitchell + PR c++/19253 + * parser.c (cp_parser_diagnose_invalid_type_name): Commit to + tentative parses. + PR c++/19667 * pt.c (redeclare_class_template): Robustify. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9b43eff3358..1599d9c0637 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1961,7 +1961,10 @@ cp_parser_non_integral_constant_expression (cp_parser *parser, } /* Emit a diagnostic for an invalid type name. SCOPE is the - qualifying scope (or NULL, if none) for ID. */ + qualifying scope (or NULL, if none) for ID. This function commits + to the current active tentative parse, if any. (Otherwise, the + problematic construct might be encountered again later, resulting + in duplicate error messages.) */ static void cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id) @@ -2033,6 +2036,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id) else gcc_unreachable (); } + cp_parser_commit_to_tentative_parse (parser); } /* Check for a common situation where a type-name should be present, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06c06d3a3d6..dd24748487c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-01-28 Mark Mitchell + PR c++/19253 + * g++.dg/template/crash33.C: New test. + PR c++/19667 * g++.dg/template/crash32.C: New test. diff --git a/gcc/testsuite/g++.dg/template/crash33.C b/gcc/testsuite/g++.dg/template/crash33.C new file mode 100644 index 00000000000..059e328f436 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash33.C @@ -0,0 +1,8 @@ +// PR c++/19253 + +namespace N {} + +template struct A +{ + A > a; // { dg-error "" } +}; -- 2.11.4.GIT