diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2004-12-09 12:33:09 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2004-12-09 12:33:09 +0000 |
commit | 354e22e18a16bca6c815347110b6fda802ce82be (patch) | |
tree | 54210854a1b232c63d07840a293b67f53a5e2e9a /gcc/cp/parser.c | |
parent | d16b59fa0c781e599115fad750585b2c4e42c71c (diff) | |
download | gcc-354e22e18a16bca6c815347110b6fda802ce82be.zip gcc-354e22e18a16bca6c815347110b6fda802ce82be.tar.gz gcc-354e22e18a16bca6c815347110b6fda802ce82be.tar.bz2 |
re PR c++/18757 (ICE (on invalid) in get_innermost_template_args)
gcc/cp/ChangeLog:
PR c++/18757
* parser.c (cp_parser_template_id): Don't create a CPP_TEMPLATE_ID
if parsing failed.
gcc/testsuite/ChangeLog:
* g++.dg/parse/typename5.C: Adjust for new error.
* g++.dg/parse/typename7.C: New.
From-SVN: r91935
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index dae68f3..ce3c7a6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8416,8 +8416,9 @@ cp_parser_template_id (cp_parser *parser, should we re-parse the token stream, we will not have to repeat the effort required to do the parse, nor will we issue duplicate error messages about problems during instantiation of the - template. */ - if (start_of_id) + template. Do so only if parsing succeeded, otherwise we may + silently accept template arguments with syntax errors. */ + if (start_of_id && !cp_parser_error_occurred (parser)) { cp_token *token = cp_lexer_token_at (parser->lexer, start_of_id); |