re PR c++/34892 (ICE with ellipsis in default template argument)

/cp
2012-10-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/34892
	* parser.c (cp_parser_template_parameter): When
	cp_parser_parameter_declaration parsed a default argument don't
	see if *is_parameter_pack needs setting.

/testsuite
2012-10-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/34892
	* g++.dg/template/crash114.C: New.

From-SVN: r192802
This commit is contained in:
Paolo Carlini 2012-10-25 09:12:22 +00:00
parent dc3e0b5501
commit 3a969a32ff
4 changed files with 30 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/34892
* parser.c (cp_parser_template_parameter): When
cp_parser_parameter_declaration parsed a default argument don't
see if *is_parameter_pack needs setting.
2012-10-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54922

View File

@ -12258,12 +12258,21 @@ cp_parser_template_parameter (cp_parser* parser, bool *is_non_type,
parameter_declarator->declarator->parameter_pack_p = false;
}
if (parameter_declarator
&& parameter_declarator->default_argument)
{
/* Can happen in some cases of erroneous input (c++/34892). */
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
/* Consume the `...' for better error recovery. */
cp_lexer_consume_token (parser->lexer);
}
/* If the next token is an ellipsis, and we don't already have it
marked as a parameter pack, then we have a parameter pack (that
has no declarator). */
if (!*is_parameter_pack
&& cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)
&& declarator_can_be_parameter_pack (parameter_declarator->declarator))
else if (!*is_parameter_pack
&& cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)
&& (declarator_can_be_parameter_pack
(parameter_declarator->declarator)))
{
/* Consume the `...'. */
cp_lexer_consume_token (parser->lexer);

View File

@ -1,7 +1,12 @@
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/34892
* g++.dg/template/crash114.C: New.
2012-10-24 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/55049
* gcc.target/i386/pr55049-1.c: New test.
* gcc.target/i386/pr55049-1.c: New test.
2012-10-24 Janus Weil <janus@gcc.gnu.org>

View File

@ -0,0 +1,5 @@
// PR c++/34892
template<int=..., int=0> struct A {}; // { dg-error "expected primary" }
A<0> a;