From patchwork Sat Oct 31 16:15:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 538667 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 BFE7B141388 for ; Sun, 1 Nov 2015 04:17:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XXdn5FVv; 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:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=HSwnL+pKt8HYCGGQQZ+wL66s9VG/FnEflAqP3On9qYB4bW2EOB lp+WlhAHEouUYjP4K0iRFuwIS9kCHiqbHj8jNxJTHuxkZtXu+EQxmu3pxYCj1ELu XhuGOR+sG6i+XdbKor2P2vcEBZ+4l8uT9gROtvFDX+ok4BlVmMjzIjW+U= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=9SyrcF7LgLnyyl5qyiC33YeVG7g=; b=XXdn5FVvDrmJ682rz2P1 Mv9j6I06wKDOPPECCLzuaOFNVSDHF3q0WsHmZz5AC05QSyLnUyxXLRsoHb4UTWdH R+PMcxdGyMlfqSNNpmjCnwszt05l/eIeDF8bLPWJBevRfQKLw2RPzGgWAFxUdX87 cmvDhGdRvdYYJKeemubeF9o= Received: (qmail 88955 invoked by alias); 31 Oct 2015 17:16:56 -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 88913 invoked by uid 89); 31 Oct 2015 17:16:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 31 Oct 2015 17:16:50 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 3361E163972; Sat, 31 Oct 2015 17:16:48 +0000 (UTC) Received: from [10.10.116.32] (ovpn-116-32.rdu2.redhat.com [10.10.116.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9VGFimj020869; Sat, 31 Oct 2015 12:15:45 -0400 From: Jason Merrill Subject: C++ PATCH for Concepts TS multiple auto To: gcc-patches List Cc: Ville Voutilainen , Andrew Sutton Message-ID: <5634E930.6080700@redhat.com> Date: Sat, 31 Oct 2015 12:15:44 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 The Concepts TS extends 'auto' deduction so that auto, or a constrained-type-specifier, can appear anywhere in the type of a declaration, rather than only as a type-specifier. This was already implemented for function parameters; this patch implements it for variables as well. Use of a constrained-type-specifier as a placeholder for a non-type or template template argument is not supported yet, however. The second patch is a prerequisite, changing for_each_template_parameter to return a tree value rather than 1 or 0. The third and fourth patches are small bits I noticed while working on this: the third improves the error messages for auto deduction failure and the fourth uses the hash function on the template's UID rather than using it directly as the seed. Tested x86_64-pc-linux-gnu, applying to trunk. commit 82a9072ecc7393b141b6923abe22820c7d813498 Author: Jason Merrill Date: Fri Oct 30 14:55:57 2015 -0400 * pt.c (hash_tmpl_and_args): Use iterative_hash_object on template uid. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 438ec2d..243464d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1682,7 +1682,7 @@ spec_hasher::equal (spec_entry *e1, spec_entry *e2) static hashval_t hash_tmpl_and_args (tree tmpl, tree args) { - hashval_t val = DECL_UID (tmpl); + hashval_t val = iterative_hash_object (DECL_UID (tmpl), 0); return iterative_hash_template_arg (args, val); }