From patchwork Mon Feb 20 06:02:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 729728 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 3vRY373dgpz9s86 for ; Mon, 20 Feb 2017 17:03:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="CwFcySsg"; 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:from:date:message-id:subject:to:content-type; q= dns; s=default; b=dIP78XGgIxvFKOv54fNAxQu289FcrirQAUOeoE0wz25xfl 1RNqmdN6k52ZPZbklvSXRJ7oDRfF32YLtUDGpyOHI8pvJmPboUoQtmXPGHQ4sLRS Of8tdOqcHHu77j2RjKyVVmaYpOX5Dy8QfwsiBwj5tuIW6Tp5USTo3+iOGihPA= 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:from:date:message-id:subject:to:content-type; s= default; bh=0A6cB8HvNXH1ArCkJfwFCprR0aI=; b=CwFcySsgls0JA+O4YGhI zz71yHtSQXzlG0iOW3zCzVVh2xgakEZNdqQzP++bqJdeHHJyUQmdf22KkIVmuzXg uxVAPPPf6ZiwfPcE1PJgJcSOPJTaqpXlfeOj42wJ+NTD+fEwCNcidak4ffoRgvZ4 +rkyk/8Yp2Gwc20eJTqCnYg= Received: (qmail 44530 invoked by alias); 20 Feb 2017 06:02:48 -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 44206 invoked by uid 89); 20 Feb 2017 06:02:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=ppd X-HELO: mail-oi0-f53.google.com Received: from mail-oi0-f53.google.com (HELO mail-oi0-f53.google.com) (209.85.218.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Feb 2017 06:02:23 +0000 Received: by mail-oi0-f53.google.com with SMTP id u143so47336703oif.3 for ; Sun, 19 Feb 2017 22:02:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=hR0k+ZDkjvhMhEi8ve+oRQb7A7SWJA5cXyCO376Ci8U=; b=IYDDNPBj23tC9ussoaFJ5b/wTc519aLcMTRip8AOxHCW3i8FyPwt9PoDRk9E2Ef10Q PS8IB3iLZkHm5FJY0477vtl60mbQPF9Qo+ygVJTnWI4Vy0JmHS5Gny/71Ms1KuGyMZRP ERzXfdz1RVb19f1XGXN/JlFwwTaw0+zF3eYeC9Dbc3FXDI4Yo9ImBlrV2WkYv7CHkcm5 QHiGt3OSJzGPy9Y0qye4usZ1WFLpf1BdM759hJpEEui9Hs5rvZnmI5tsQdbqtDrpgGrR l/MieOm3NTwjIRIOg3nOUoEhnNSLLane8H2FhnWSrQds7EUZEf/MmgsbpxyIiZ5q17Sz P0bQ== X-Gm-Message-State: AMke39mW+Czw7szFbSNBi8MbcPEpu97sg6Aj4+sm4zBTvkZyFMsPg0UFlf/8rFiSLWFF+GEs++vcqfYUbbcHQLnz X-Received: by 10.202.181.10 with SMTP id e10mr10444670oif.117.1487570540966; Sun, 19 Feb 2017 22:02:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.5.4 with HTTP; Sun, 19 Feb 2017 22:02:00 -0800 (PST) From: Jason Merrill Date: Sun, 19 Feb 2017 22:02:00 -0800 Message-ID: Subject: C++ PATCH for c++/78282, auto template and pack expansion To: gcc-patches List X-IsSubscribed: yes When looking for parameter packs mentioned within an expression, we were wrongly walking into the type of a TEMPLATE_DECL mentioned in the expression. We're only interested in packs in the type of a template template-parameter, not other kinds of template. Tested x86_64-pc-linux-gnu, applying to trunk. commit 1835d19d99d5e89155c566d6305c878ca0c75678 Author: Jason Merrill Date: Sun Feb 19 16:08:29 2017 -0800 PR c++/78282 - auto template and pack expansion * pt.c (find_parameter_packs_r): Don't walk into the type of templates other than template template-parameters. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0a9f5d5..2cac24f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3576,8 +3576,12 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) *walk_subtrees = 0; return NULL_TREE; - case CONSTRUCTOR: case TEMPLATE_DECL: + if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t)) + return NULL_TREE; + gcc_fallthrough(); + + case CONSTRUCTOR: cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, ppd->visited); return NULL_TREE; diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn36.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn36.C new file mode 100644 index 0000000..f89c092 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn36.C @@ -0,0 +1,26 @@ +// PR c++/78282 +// { dg-do compile { target c++14 } } + +struct null_node +{ + null_node(const null_node&); +}; + +extern null_node null; + +template +auto get() { return null; } + +template +struct inheritor: Ts... +{ + inheritor(const inheritor& outer) + : Ts(get())... + { } +}; + +void test() +{ + extern inheritor example; + inheritor result(example); +}