Commit 08f8b665 by Paolo Carlini Committed by Paolo Carlini

re PR c++/67318 (Parsing error when using abbreviated integral type names in…

re PR c++/67318 (Parsing error when using abbreviated integral type names in template parameter pack declaration)

/cp
2015-09-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67318
	* parser.c (cp_parser_parameter_declaration): Consume the ellipsis
	and set template_parameter_pack_p also when the type is null.

/testsuite
2015-09-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67318
	* g++.dg/cpp0x/variadic166.C: New.

From-SVN: r227650
parent dbb68221
2015-09-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67318
* parser.c (cp_parser_parameter_declaration): Consume the ellipsis
and set template_parameter_pack_p also when the type is null.
2015-09-09 Mark Wielaard <mjw@redhat.com>
* typeck.c (cp_build_binary_op): Check and warn when nonnull arg
......
......@@ -19613,11 +19613,12 @@ cp_parser_parameter_declaration (cp_parser *parser,
}
}
/* If the next token is an ellipsis, and we have not seen a
declarator name, and the type of the declarator contains parameter
packs but it is not a TYPE_PACK_EXPANSION, then we actually have
a parameter pack expansion expression. Otherwise, leave the
ellipsis for a C-style variadic function. */
/* If the next token is an ellipsis, and we have not seen a declarator
name, and if either the type of the declarator contains parameter
packs but it is not a TYPE_PACK_EXPANSION or is null (this happens
for, eg, abbreviated integral type names), then we actually have a
parameter pack expansion expression. Otherwise, leave the ellipsis
for a C-style variadic function. */
token = cp_lexer_peek_token (parser->lexer);
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
{
......@@ -19626,11 +19627,12 @@ cp_parser_parameter_declaration (cp_parser *parser,
if (type && DECL_P (type))
type = TREE_TYPE (type);
if (type
&& TREE_CODE (type) != TYPE_PACK_EXPANSION
&& declarator_can_be_parameter_pack (declarator)
&& (template_parm_p || uses_parameter_packs (type)))
{
if (((type
&& TREE_CODE (type) != TYPE_PACK_EXPANSION
&& (template_parm_p || uses_parameter_packs (type)))
|| (!type && template_parm_p))
&& declarator_can_be_parameter_pack (declarator))
{
/* Consume the `...'. */
cp_lexer_consume_token (parser->lexer);
maybe_warn_variadic_templates ();
2015-09-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67318
* g++.dg/cpp0x/variadic166.C: New.
2015-09-09 Mark Wielaard <mjw@redhat.com>
* c-c++-common/nonnull-1.c: New test.
......
// PR c++/67318
// { dg-do compile { target c++11 } }
template<signed...>
struct MyStruct1;
template<unsigned...>
struct MyStruct2;
template<short...>
struct MyStruct3;
template<long...>
struct MyStruct4;
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