commit b7486132b037ea59ac7e6524085e4e765dc22852
Author: Jason Merrill <jason@redhat.com>
Date: Mon Apr 16 12:49:13 2012 -0400
PR c++/52008
* pt.c (process_partial_specialization): Complain about a partial
specialization with fewer args than primary template parms.
@@ -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
new file mode 100644
@@ -0,0 +1,8 @@
+// PR c++/52008
+// { dg-do compile { target c++11 } }
+
+template <int I, typename T, typename... Ts>
+struct A;
+
+template<typename... Ts>
+struct A<0, Ts...>; // { dg-error "not more specialized" }