From: Jason Merrill Date: Fri, 29 Mar 2013 18:59:35 +0000 (-0400) Subject: re PR c++/56774 (G++ 4.8 reverses variadic template types during unpacking) X-Git-Tag: releases/gcc-4.7.3~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e46441224c1c6165a1907bebe30f88b20cdb8d5;p=thirdparty%2Fgcc.git re PR c++/56774 (G++ 4.8 reverses variadic template types during unpacking) PR c++/56774 PR c++/35722 * pt.c (unify_pack_expansion): Fix indexing. From-SVN: r197246 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b22536262b67..58c2b149c20e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-29 Jason Merrill + + PR c++/56774 + PR c++/35722 + * pt.c (unify_pack_expansion): Fix indexing. + 2013-03-23 Jason Merrill PR c++/54277 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d8b77ad0fed4..783a8ee54c30 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15727,10 +15727,10 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, arg = NULL_TREE; if (TREE_VALUE (pack) && (pargs = ARGUMENT_PACK_EXPLICIT_ARGS (TREE_VALUE (pack))) - && (i < TREE_VEC_LENGTH (pargs))) + && (i - start < TREE_VEC_LENGTH (pargs))) { any_explicit = true; - arg = TREE_VEC_ELT (pargs, i); + arg = TREE_VEC_ELT (pargs, i - start); } TMPL_ARG (targs, level, idx) = arg; } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-explicit2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-explicit2.C new file mode 100644 index 000000000000..4a80745293a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-explicit2.C @@ -0,0 +1,14 @@ +// PR c++/56774 +// { dg-require-effective-target c++11 } + +template +struct mytype {}; + +template +void something( mytype ) +{ } + +int main() +{ + something( mytype() ); +}