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: r146609
This commit is contained in:
Dodji Seketeli 2009-04-22 19:16:13 +00:00 committed by Dodji Seketeli
parent 46c0245d2c
commit 99e6d0a266
4 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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 Release Manager
* GCC 4.4.0 released.

View File

@ -10477,6 +10477,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);

View File

@ -1,3 +1,8 @@
2009-04-22 Dodji Seketeli <dodji@redhat.com>
PR c++/39639
* g++.dg/cpp0x/pr39639.C: New test.
2009-04-22 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline:

View File

@ -0,0 +1,20 @@
// 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 ();
}