aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-03-29 14:59:09 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-03-29 14:59:09 -0400
commit4185fb7350876f0012455c3dd159f80494081686 (patch)
treed59d9129625333679cb95a7666d260fcf464b420 /gcc
parent0208f7dab09ed1ceb3fcfceff049e24cc05d69fa (diff)
downloadgcc-4185fb7350876f0012455c3dd159f80494081686.zip
gcc-4185fb7350876f0012455c3dd159f80494081686.tar.gz
gcc-4185fb7350876f0012455c3dd159f80494081686.tar.bz2
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: r197244
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-explicit2.C14
3 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 224c5a2..6686bdc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/56774
+ PR c++/35722
+ * pt.c (unify_pack_expansion): Fix indexing.
+
2013-03-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
* call.c (build_java_interface_fn_ref): Likewise.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8468a84..4ef4ede 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -16213,10 +16213,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 0000000..4a80745
--- /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 <class ... Args>
+struct mytype {};
+
+template <class T, class ... Args>
+void something( mytype<T, Args...> )
+{ }
+
+int main()
+{
+ something<int, char, bool>( mytype<int, char, bool>() );
+}