From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 659 invoked by alias); 29 Mar 2013 18:58:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 518 invoked by uid 89); 29 Mar 2013 18:58:21 -0000 X-Spam-SWARE-Status: No, score=-7.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 29 Mar 2013 18:58:19 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2TIwITn023974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 29 Mar 2013 14:58:18 -0400 Received: from [10.3.113.94] (ovpn-113-94.phx2.redhat.com [10.3.113.94]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2TIwGbu004975 for ; Fri, 29 Mar 2013 14:58:17 -0400 Message-ID: <5155E448.3040706@redhat.com> Date: Fri, 29 Mar 2013 18:58:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Thunderbird/21.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/56774 (jumbled variadic template args) Content-Type: multipart/mixed; boundary="------------020001030400050602060305" X-Virus-Found: No X-SW-Source: 2013-03/txt/msg01284.txt.bz2 This is a multi-part message in MIME format. --------------020001030400050602060305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 190 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. --------------020001030400050602060305 Content-Type: text/x-patch; name="56774.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="56774.patch" Content-length: 1388 commit 4b4cf682c8f7d15d3cf3097a2f4cf4f7f4f6acb5 Author: Jason Merrill 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 +struct mytype {}; + +template +void something( mytype ) +{ } + +int main() +{ + something( mytype() ); +} --------------020001030400050602060305--