From patchwork Tue Apr 17 02:25:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 153026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B6FB9B705B for ; Tue, 17 Apr 2012 12:26:17 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1335234378; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=Q1eWB+2 ctcGt8U+5Zm7TCo0tIWU=; b=uCGWWt7YRCYP7RmWo18bmdym0HMLWH1dEPXn9ma z7EuotGLlEsG3QHOaYW4D+lOvvN5b265oeE+u6yiXJSMHzTJcI1b8XFiTonSnkRN WkB6iY8q1RARflbdl/sJS/6r49HIKCaWFs02gfsZPn1d96yqw5Oq3JbZaXYPbdk9 jK8o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mZUZp0MnvQmqFSPhpLdEsjeNbZQLCMrgO/zvBMBk6urWbzoqQp12Dd1NJpHqOP 7wb9SJPUkzbpEmtLwEa+TB3dAd9G1E2fRuJLxRPLjoEvci0F2rzOvG+L0l6cuflA MtW2joDPL8oIwxLbfup7CEFuEw+eacQCtnVCfRt7Qpuk4=; Received: (qmail 31867 invoked by alias); 17 Apr 2012 02:26:13 -0000 Received: (qmail 31850 invoked by uid 22791); 17 Apr 2012 02:26:13 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 02:25:58 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3H2Pw3V018889 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 Apr 2012 22:25:58 -0400 Received: from [10.3.113.15] ([10.3.113.15]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3H2PvXh018063 for ; Mon, 16 Apr 2012 22:25:58 -0400 Message-ID: <4F8CD4B5.2060304@redhat.com> Date: Mon, 16 Apr 2012 22:25:57 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/50830 (another variadic template template parameter issue) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Here, we were getting confused and thinking that an argument pack of template template arguments wasn't suitable for a template template parameter pack. But it is. Tested x86_64-pc-linux-gnu, applying to trunk. commit 6143aa83bb48ef7c9d2bbcb0dff13a964036b3d1 Author: Jason Merrill Date: Mon Apr 16 11:53:57 2012 -0400 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 7423781..fcefc94 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6428,6 +6428,7 @@ convert_template_argument (tree parm, is_tmpl_type = ((TREE_CODE (arg) == TEMPLATE_DECL && TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL) + || (requires_tmpl_type && TREE_CODE (arg) == TYPE_ARGUMENT_PACK) || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM || TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE); @@ -6499,7 +6500,9 @@ convert_template_argument (tree parm, { if (requires_tmpl_type) { - if (TREE_CODE (TREE_TYPE (arg)) == UNBOUND_CLASS_TEMPLATE) + if (template_parameter_pack_p (parm) && ARGUMENT_PACK_P (orig_arg)) + val = orig_arg; + else if (TREE_CODE (TREE_TYPE (arg)) == UNBOUND_CLASS_TEMPLATE) /* The number of argument required is not known yet. Just accept it for now. */ val = TREE_TYPE (arg); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic129.C b/gcc/testsuite/g++.dg/cpp0x/variadic129.C new file mode 100644 index 0000000..7118301 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic129.C @@ -0,0 +1,19 @@ +// PR c++/50830 +// { dg-do compile { target c++11 } } + +template class...> +struct list_templates {}; + +template +struct aa {}; + +template +struct test {}; + +template class... F, class T> +struct test, T> +{ + struct inner {}; +}; + +test, int> a4; // error