Commit a58f7da1 by Dodji Seketeli Committed by Dodji Seketeli

re PR c++/39639 (no diagnostic for ill-formed pack expansion)

2009-04-22  Dodji Seketeli  <dodji@redhat.com>

    gcc/cp/ChangeLog:
    	PR c++/39639
    	* parser.c (cp_parser_template_argument_list): Display an error
    	when an ellipsis is not preceded by a parameter pack. Also, warn
    	about variadic templates usage without -std=c++0x.
    
    gcc/testsuite/ChangeLog:
    	PR c++/39639
    	* g++.dg/cpp0x/pr39639.C: New test.

From-SVN: r146610
parent d1b38208
2009-04-22 Dodji Seketeli <dodji@redhat.com>
PR c++/39639
* parser.c (cp_parser_template_argument_list): Display an error
when an ellipsis is not preceded by a parameter pack. Also, warn
about variadic templates usage without -std=c++0x.
2009-04-21 Taras Glek <tglek@mozilla.com>
* cp-tree.h: Update GTY annotations to new syntax.
......
......@@ -10470,6 +10470,12 @@ cp_parser_template_argument_list (cp_parser* parser)
argument pack. */
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
{
if (argument == error_mark_node)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
error ("%Hexpected parameter pack before %<...%>",
&token->location);
}
/* Consume the `...' token. */
cp_lexer_consume_token (parser->lexer);
......
2009-04-22 Dodji Seketeli <dodji@redhat.com>
PR c++/39639
* g++.dg/cpp0x/pr39639.C: New test.
2009-04-22 Mark Heffernan <meheff@google.com>
* gcc.dg/profile-generate-3.c: New test.
......
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin: PR c++/39639
// { dg-options "-std=c++0x" }
// { dg-do "compile" }
template <class... Types>
struct S
: S<...Types>, // { dg-error "expected parameter pack before '...'" }
S<...Types...>, // { dg-error "expected parameter pack before '...'" }
S<...> // { dg-error "expected parameter pack before '...'" }
{
static int f () { return 1;}
};
int
main ()
{
return S<void>::f ();
}
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