From: Dodji Seketeli Date: Wed, 22 Apr 2009 19:13:40 +0000 (+0000) Subject: re PR c++/39639 (no diagnostic for ill-formed pack expansion) X-Git-Tag: releases/gcc-4.3.4~214 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa221046ee99fa30c7894518e079f53a49d6f513;p=thirdparty%2Fgcc.git re PR c++/39639 (no diagnostic for ill-formed pack expansion) 2009-04-22 Dodji Seketeli 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: r146608 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d363604a6d21..7e5eb2d78cb0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-04-22 Dodji Seketeli + + 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-13 Jason Merrill PR c++/39480 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ec3130ab9c12..80b194939772 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10095,6 +10095,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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 512d3e7f819b..a9b3c604fc33 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-04-22 Dodji Seketeli + + PR c++/39639 + * g++.dg/cpp0x/pr39639.C: New test. + 2009-04-22 Richard Guenther Backport from mainline: diff --git a/gcc/testsuite/g++.dg/cpp0x/pr39639.C b/gcc/testsuite/g++.dg/cpp0x/pr39639.C new file mode 100644 index 000000000000..abd3bcf086a9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr39639.C @@ -0,0 +1,20 @@ +// Contributed by Dodji Seketeli +// Origin: PR c++/39639 +// { dg-options "-std=c++0x" } +// { dg-do "compile" } + +template +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::f (); +} +