From patchwork Wed Jan 11 20:13:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 90989 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1299377qgi; Wed, 11 Jan 2017 12:13:39 -0800 (PST) X-Received: by 10.84.132.1 with SMTP id 1mr15995241ple.44.1484165619689; Wed, 11 Jan 2017 12:13:39 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k17si6754961pgh.279.2017.01.11.12.13.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 12:13:39 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445902-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445902-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445902-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=yIXZmINWKaio/1/Qq5csiWC3QyewBR8FUI5j7JauO9J34vzyBi AsmsKZtGYF0TEh15LMag0LgjETTl+CPzJ5b96ocVp6Gx79T+Sb0rLN76/hZ9IdyL lahtPBPu6FVYsZuiZ467lBmjoMtuk+hcOH8/t/yKSf2NvpeyImJML7+iA= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=Es0Ck1jl1SsCEBRpcO+kWIfopBs=; b=CLR8D6UQy3SMpFAsmty/ 3zYSRGiE/8kykbh4wpMZpXAlg+Gm+L2N/Y1B2+xJUILXsh5WjSjHhJLtJ7Cc7NPE 4jnORSsVxiSzpLW+p1g93sDaQ7hT2q8FbUieQvy5RnlBrpb2VmlMigG4iEQuQGju +b61f1LtpsOfc1AuwZLABYE= Received: (qmail 47100 invoked by alias); 11 Jan 2017 20:13:26 -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 47086 invoked by uid 89); 11 Jan 2017 20:13:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yb0-f195.google.com Received: from mail-yb0-f195.google.com (HELO mail-yb0-f195.google.com) (209.85.213.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jan 2017 20:13:15 +0000 Received: by mail-yb0-f195.google.com with SMTP id p3so1610874yba.2 for ; Wed, 11 Jan 2017 12:13:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:cc:from:subject:message-id:date :user-agent:mime-version; bh=oB6gTHAxAWQTRAwn8ykDTh8eTgBk14VwAVXTNEAIr5w=; b=mJl482PolUH3ODDcTJ9+jIHf1KLedYkdvCt2CBSW1v1I3Jhva6ywJNauOzF9q4i5Nq Wqf5t3J5f+Twr5adi57uD7mzltentZI2WDQ1VARF3NWpzwDAnwg1khk+Av8vWda315eF mv1nLas5Qq7JlH3LwM8Vv1r16iZYCtY2v8dyg8+YLJy1DgryiKHhbFRkfokk4BhKZzY/ 3wzEQGBwFTH4mYV/JCfXKyGHgTl7ep/LgG7hg59pZ8s55OA/gWUKVeIlLrW3/seUaIcH +toJtVMUR1ef8y27edSaOkzpjqTssv428vuqFzkW5z/UAEeDx37a73/Zj2ETo4mmDNdP werA== X-Gm-Message-State: AIkVDXJfQ1ewH5d0L1swS2YiHyvXbe2n04qIhhHqP7avSVnNFmbRcniGoIpm6nbyMXZ7Cg== X-Received: by 10.37.205.196 with SMTP id d187mr5886355ybf.161.1484165594188; Wed, 11 Jan 2017 12:13:14 -0800 (PST) Received: from ?IPv6:2620:10d:c0a3:20fb:f6d0:5ac5:64cd:f102? ([2620:10d:c091:200::d:41ba]) by smtp.googlemail.com with ESMTPSA id v1sm2781086ywc.17.2017.01.11.12.13.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 12:13:13 -0800 (PST) To: GCC Patches Cc: Jason Merrill From: Nathan Sidwell Subject: [C++ PATCH] Overload pushing cleanup Message-ID: <5adc918d-6100-9d4a-0c67-14795d08ab4e@acm.org> Date: Wed, 11 Jan 2017 15:13:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In fixing 77812, a name lookup bug, I got confused by the overload creation code, which seemed a bit complex. This simplifies it by clearly separating the optional wrapping of a single decl from the subsequent prepending of the new decl. applied to trunk nathan -- Nathan Sidwell 2017-01-11 Nathan Sidwell * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation. Index: cp/name-lookup.c =================================================================== --- cp/name-lookup.c (revision 244314) +++ cp/name-lookup.c (working copy) @@ -2454,9 +2454,11 @@ push_overloaded_decl_1 (tree decl, int f || (flags & PUSH_USING)) { if (old && TREE_CODE (old) != OVERLOAD) - new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE)); + /* Wrap the existing single decl in an overload. */ + new_binding = ovl_cons (old, NULL_TREE); else - new_binding = ovl_cons (decl, old); + new_binding = old; + new_binding = ovl_cons (decl, new_binding); if (flags & PUSH_USING) OVL_USED (new_binding) = 1; }