From patchwork Sun Jul 24 02:55:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 652069 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rxpv05hBbz9sRZ for ; Sun, 24 Jul 2016 12:56:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=AJHHDUp4; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; q=dns; s=default; b=GNSr8kBisefbeq7rr9 6iSG1d/iNnwSEDQVMJgvCcNHRLK5KhkPwZEIY/wkUIDXb8VmcOP82sM7PZanc4xB 4gGWk+0GJLdkb9KTSWI0vMuq5+bxrwGsYv1G4jmyklPvPwX2PuHOpvweyGbok8C6 X3OACgfsFJddyXVT72lMfg2hY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; s=default; bh=T2VqvfmsaKemN/j+1a1ZPmSE WT0=; b=AJHHDUp4aavjkn+G6wlEvfTV7K9/pTGJdEe1PvLDoPE8AfpEJnvN5t7S CV6E5GUKLZ8Ltm4sxMQXJX8VQ56ilTurJ4KV+lq77sFWIQM/WpbIUfdpPa11qhAO +uBCliNDQHIumel3E5bWoz2Rc1oPAlQC27LVAb7T5bujKsIfdW8= Received: (qmail 40352 invoked by alias); 24 Jul 2016 02:56:22 -0000 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 Received: (qmail 40039 invoked by uid 89); 24 Jul 2016 02:56:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=tmpl X-HELO: mail-oi0-f44.google.com Received: from mail-oi0-f44.google.com (HELO mail-oi0-f44.google.com) (209.85.218.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 24 Jul 2016 02:56:01 +0000 Received: by mail-oi0-f44.google.com with SMTP id l65so211531968oib.1 for ; Sat, 23 Jul 2016 19:56:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=JvmmwyOQ9x/Sbo9xTjPP8OXlngEFa3SU7sBObYzqe1I=; b=fQSZD126tYb1gsEnFcPeXY+aRNW5R1aUC0euC5IwJzZ4/LLHkpFkoFp2yFOE1LE5jt abxDfgxnLvG9YkeZ0M6jZRYGNSaxTrlb6uaq5LK684M1wb2uRJj8rajJI91U3jvwjoaU PNOKlZFfkrDhF4KTpoQsP7sXWFzlfEbaLlYkgnpB0vIvwPJLymE57tiJmNxGQIeIWgme pmz7uz0+EL1bic5KrPyJzwp4GGQuEdawJlrTNw07loE26fUUc2DyKIeYbhjHu+zqSh8B wt0kTcdb4Oq3oo/Tjs5r28zQ8KhYTROqRH0xp6u7VM5n7LHZHepfjCUxsv5t07Pdbl3F GJDQ== X-Gm-Message-State: AEkoout1zhPqGbSBS6/w0Jji1rxyHTaEYRyEj+ToRhchQ6utRDfy7RsBPGDQhWfF/SI1fs17STqqV1KJ/W+sPbSJ X-Received: by 10.157.1.111 with SMTP id 102mr5768078otu.155.1469328959344; Sat, 23 Jul 2016 19:55:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.105.169 with HTTP; Sat, 23 Jul 2016 19:55:39 -0700 (PDT) In-Reply-To: References: From: Jason Merrill Date: Sat, 23 Jul 2016 22:55:39 -0400 Message-ID: Subject: Re: C++ PATCH for c++/70778 (ICE with member template template parameter) To: gcc-patches List X-IsSubscribed: yes On Sat, Jul 23, 2016 at 10:50 PM, Jason Merrill wrote: > Here when we partially instantiated the declaration of the AddToFront > partial specialization, which meant substituting into > "Holder", we weren't replacing KeyType in the template > parameter list of Holder, leading to confusion when we encounter it > later and try to substitute in 0. > > Tested x86_64-pc-linux-gnu, applying to trunk. commit fa7e4de043897f89467887f84e705cdd3a0cfb79 Author: Jason Merrill Date: Fri Jul 22 16:42:52 2016 -0400 PR c++/70778 - member template template parameter * pt.c (tsubst): Also substitute into the template of a BOUND_TEMPLATE_TEMPLATE_PARM. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a44bead..65fa982 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13232,13 +13232,20 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) if (code == BOUND_TEMPLATE_TEMPLATE_PARM) { - tree argvec = tsubst (TYPE_TI_ARGS (t), args, + tree tinfo = TYPE_TEMPLATE_INFO (t); + /* We might need to substitute into the types of non-type + template parameters. */ + tree tmpl = tsubst (TI_TEMPLATE (tinfo), args, + complain, in_decl); + if (tmpl == error_mark_node) + return error_mark_node; + tree argvec = tsubst (TI_ARGS (tinfo), args, complain, in_decl); if (argvec == error_mark_node) return error_mark_node; TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (r) - = build_template_info (TYPE_TI_TEMPLATE (t), argvec); + = build_template_info (tmpl, argvec); } } break; diff --git a/gcc/testsuite/g++.dg/template/ttp29.C b/gcc/testsuite/g++.dg/template/ttp29.C new file mode 100644 index 0000000..7d4e03a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ttp29.C @@ -0,0 +1,21 @@ +// PR c++/70778 + +template +struct Stuff +{ + template + struct AddToFront; + + template class Holder, KeyType Indexs> + struct AddToFront > + { + }; +}; + +template +struct Holder {}; + +int main() +{ + Stuff::AddToFront<0, Holder<24> > t; +}