diff options
author | Jason Merrill <jason@redhat.com> | 2012-04-16 22:29:43 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-04-16 22:29:43 -0400 |
commit | 54aa834f49ab0e8855400d7d9ed513bf666ecb24 (patch) | |
tree | b5ab32085385e50b7bee4e97f9f88f59ee30f2a4 /gcc | |
parent | 3ab97d92fc7e94b54411aa7629b13b4a4381304b (diff) | |
download | gcc-54aa834f49ab0e8855400d7d9ed513bf666ecb24.zip gcc-54aa834f49ab0e8855400d7d9ed513bf666ecb24.tar.gz gcc-54aa834f49ab0e8855400d7d9ed513bf666ecb24.tar.bz2 |
re PR c++/52008 ([Core/1495] ICE when adding partial specialization for variadic-templated structure)
PR c++/52008
* pt.c (process_partial_specialization): Complain about a partial
specialization with fewer args than primary template parms.
From-SVN: r186521
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/variadic130.C | 8 |
4 files changed, 27 insertions, 0 deletions
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 <jason@redhat.com> + 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 <jason@redhat.com> + 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 <int I, typename T, typename... Ts> +struct A; + +template<typename... Ts> +struct A<0, Ts...>; // { dg-error "not more specialized" } |