diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2016-05-18 16:26:35 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2016-05-18 16:26:35 +0000 |
commit | c584aca60cbface2621ebf1ccc943df1b7af52ca (patch) | |
tree | 3334df65b31e82ffa1da6e7e4a31d5317142db8f /gcc | |
parent | 28644f75a950c0710e49948b93321eb47004c438 (diff) | |
download | gcc-c584aca60cbface2621ebf1ccc943df1b7af52ca.zip gcc-c584aca60cbface2621ebf1ccc943df1b7af52ca.tar.gz gcc-c584aca60cbface2621ebf1ccc943df1b7af52ca.tar.bz2 |
re PR c++/69793 (ICE on invalid code in "cp_lexer_peek_nth_token")
/cp
2016-05-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69793
* parser.c (cp_parser_template_id): Don't call cp_lexer_peek_nth_token
when the previous cp_lexer_peek_token returns CPP_EOF.
/testsuite
2016-05-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69793
* g++.dg/template/crash122.C: New.
From-SVN: r236414
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash122.C | 4 |
4 files changed, 19 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4dc6755..f459e50 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2016-05-18 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/69793 + * parser.c (cp_parser_template_id): Don't call cp_lexer_peek_nth_token + when the previous cp_lexer_peek_token returns CPP_EOF. + +2016-05-18 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/70466 * call.c (convert_like_real): Check that we are actually converting from an init list. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 539f165..3abba12 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14835,11 +14835,11 @@ cp_parser_template_id (cp_parser *parser, /* If we find the sequence `[:' after a template-name, it's probably a digraph-typo for `< ::'. Substitute the tokens and check if we can parse correctly the argument list. */ - next_token = cp_lexer_peek_token (parser->lexer); - next_token_2 = cp_lexer_peek_nth_token (parser->lexer, 2); - if (next_token->type == CPP_OPEN_SQUARE + if (((next_token = cp_lexer_peek_token (parser->lexer))->type + == CPP_OPEN_SQUARE) && next_token->flags & DIGRAPH - && next_token_2->type == CPP_COLON + && ((next_token_2 = cp_lexer_peek_nth_token (parser->lexer, 2))->type + == CPP_COLON) && !(next_token_2->flags & PREV_WHITE)) { cp_parser_parse_tentatively (parser); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e06f7e47..0434803 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2016-05-18 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/69793 + * g++.dg/template/crash122.C: New. + +2016-05-18 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/70466 * g++.dg/template/pr70466-1.C: New. * g++.dg/template/pr70466-2.C: Likewise. diff --git a/gcc/testsuite/g++.dg/template/crash122.C b/gcc/testsuite/g++.dg/template/crash122.C new file mode 100644 index 0000000..028aec3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash122.C @@ -0,0 +1,4 @@ +// PR c++/69793 + +class fpos; +template < state > bool operator!= (fpos,; operator!= // { dg-error "declared|expected|type" } |