Commit c584aca6 by Paolo Carlini Committed by Paolo Carlini

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
parent 28644f75
2016-05-18 Paolo Carlini <paolo.carlini@oracle.com> 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 PR c++/70466
* call.c (convert_like_real): Check that we are actually converting * call.c (convert_like_real): Check that we are actually converting
from an init list. from an init list.
......
...@@ -14835,11 +14835,11 @@ cp_parser_template_id (cp_parser *parser, ...@@ -14835,11 +14835,11 @@ cp_parser_template_id (cp_parser *parser,
/* If we find the sequence `[:' after a template-name, it's probably /* If we find the sequence `[:' after a template-name, it's probably
a digraph-typo for `< ::'. Substitute the tokens and check if we can a digraph-typo for `< ::'. Substitute the tokens and check if we can
parse correctly the argument list. */ parse correctly the argument list. */
next_token = cp_lexer_peek_token (parser->lexer); if (((next_token = cp_lexer_peek_token (parser->lexer))->type
next_token_2 = cp_lexer_peek_nth_token (parser->lexer, 2); == CPP_OPEN_SQUARE)
if (next_token->type == CPP_OPEN_SQUARE
&& next_token->flags & DIGRAPH && 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)) && !(next_token_2->flags & PREV_WHITE))
{ {
cp_parser_parse_tentatively (parser); cp_parser_parse_tentatively (parser);
2016-05-18 Paolo Carlini <paolo.carlini@oracle.com> 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 PR c++/70466
* g++.dg/template/pr70466-1.C: New. * g++.dg/template/pr70466-1.C: New.
* g++.dg/template/pr70466-2.C: Likewise. * g++.dg/template/pr70466-2.C: Likewise.
......
// PR c++/69793
class fpos;
template < state > bool operator!= (fpos,; operator!= // { dg-error "declared|expected|type" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment