public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/56774 (jumbled variadic template args)
@ 2013-03-29 18:58 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2013-03-29 18:58 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

In my patch for 35722/N2555, I forgot to adjust the index into the 
argument pack based on how many non-packed arguments there are.

Tested x86_64-pc-linux-gnu, applying to trunk, 4.8, 4.7.

[-- Attachment #2: 56774.patch --]
[-- Type: text/x-patch, Size: 1388 bytes --]

commit 4b4cf682c8f7d15d3cf3097a2f4cf4f7f4f6acb5
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 29 14:25:12 2013 -0400

    	PR c++/56774
    	PR c++/35722
    	* pt.c (unify_pack_expansion): Fix indexing.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 27e3ff8..f6101b6 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>() );
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-29 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-29 18:58 C++ PATCH for c++/56774 (jumbled variadic template args) Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).