From: jason Date: Tue, 17 Apr 2012 02:29:43 +0000 (+0000) Subject: PR c++/52008 X-Git-Tag: upstream/4.9.2~13233 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c8837b5fac1d3d39d23ba6a4f268febb5939691;p=platform%2Fupstream%2Flinaro-gcc.git PR c++/52008 * pt.c (process_partial_specialization): Complain about a partial specialization with fewer args than primary template parms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186521 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 24ce8e0..1b7f4be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2012-04-16 Jason Merrill + PR c++/52008 + * pt.c (process_partial_specialization): Complain about a partial + specialization with fewer args than primary template parms. + PR c++/50830 * pt.c (convert_template_argument): Handle template template argument packs. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index fcefc94..d6144d5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4376,6 +4376,18 @@ process_partial_specialization (tree decl) (maintmpl))))) error ("partial specialization %qT does not specialize any template arguments", type); + /* A partial specialization that replaces multiple parameters of the + primary template with a pack expansion is less specialized for those + parameters. */ + if (nargs < DECL_NTPARMS (maintmpl)) + { + error ("partial specialization is not more specialized than the " + "primary template because it replaces multiple parameters " + "with a pack expansion"); + inform (DECL_SOURCE_LOCATION (maintmpl), "primary template here"); + return decl; + } + /* [temp.class.spec] A partially specialized non-type argument expression shall not diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ced5be..2acdffe 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2012-04-16 Jason Merrill + PR c++/52008 + * g++.dg/cpp0x/variadic130.C: New. + PR c++/50830 * g++.dg/cpp0x/variadic129.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic130.C b/gcc/testsuite/g++.dg/cpp0x/variadic130.C new file mode 100644 index 0000000..f73c8b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic130.C @@ -0,0 +1,8 @@ +// PR c++/52008 +// { dg-do compile { target c++11 } } + +template +struct A; + +template +struct A<0, Ts...>; // { dg-error "not more specialized" }