diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-23 04:37:40 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-23 04:37:40 +0000 |
commit | 7525f7696fb07ad6486625b0bca9497b65f00cd4 (patch) | |
tree | 9723544456dacd2f3c339caf6c315be105a9a932 /gcc/cp | |
parent | dacbeac0ec7e3b131c607c2cc0367a2d5b15cbfe (diff) | |
download | gcc-7525f7696fb07ad6486625b0bca9497b65f00cd4.tar.gz |
PR c++/30863
* parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do
not consume tokens when failing.
PR c++/30863
* g++.dg/template/error24.C: New test.
* g++.dg/parse/tmpl-outside1.C: Tweak error markers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123152 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3de84b69166..523d52b85f0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-03-22 Mark Mitchell <mark@codesourcery.com> + + PR c++/30863 + * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do + not consume tokens when failing. + 2007-03-22 Jim Wilson <wilson@specifix.com> Mark Mitchell <mark@codesourcery.com> diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 41e7b52f980..5cfcf435ed2 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -2343,12 +2343,13 @@ cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser) the scope is dependent, we cannot do much. */ if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME) || (parser->scope && TYPE_P (parser->scope) - && dependent_type_p (parser->scope))) + && dependent_type_p (parser->scope)) + || TREE_CODE (id) == TYPE_DECL) { cp_parser_abort_tentative_parse (parser); return false; } - if (!cp_parser_parse_definitely (parser) || TREE_CODE (id) == TYPE_DECL) + if (!cp_parser_parse_definitely (parser)) return false; /* Emit a diagnostic for the invalid type. */ |