From patchwork Thu Feb 13 21:31:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1237769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519503-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=GZinNt5c; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hTidcSsf; dkim-atps=neutral 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 48JV8V3TR2z9sP7 for ; Fri, 14 Feb 2020 08:32:10 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=T2mk6ReBmxpkOQQE pDf1UQ062wonIfquNCVf7XefT16sq4XaxapZzNImzL7bQCS1crH0XKcaITNEEm6V mjcCHsyqjgq+a8Mu9SKi76PQ/1D7yAv3EVjVl0SnKg908IIFrxFJ2hcBTuwIx8fC g+7Nr7DVr6xdUUojSMZQlWlNXIo= 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 :to:subject:date:message-id:content-type :content-transfer-encoding; s=default; bh=pRmuzDj+QA1jp9xVJF+akU f8n4U=; b=GZinNt5cY0T9LmYK+L1YJQoRXlSHcvt57tYQMDrPYsTBWuqRtE6GY0 Vvu9bVu6mEKPWq28tiS4iT8pcpf6fEk7hYyFtpGYghYUnbCfY+eZdKpeflYRwCUH mIlctp3qEfwZn8Pp8Kb+YAtgih+OPKZu37xkLDeUDhFsx1ED6U+gc= Received: (qmail 110220 invoked by alias); 13 Feb 2020 21:32:03 -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 110212 invoked by uid 89); 13 Feb 2020 21:32:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Feb 2020 21:32:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581629519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=obWQkrtLvjcsyxgmi4gyLyqMX7VYbKS25qEQm2mXSgw=; b=hTidcSsf/3ewC4FCjdUX36AQJqYTD0YIMiIz6k9qT8MxeExsyVjFXGeZ/43xk0xzBrxW2E q4wxuWIcXvcCadDuw0FwlgaOBuSZkaqzVouedmj2rGhhkMoigg/6MuSKYRt4yBgJ+yLgLY RTYtEuIhibH8SakMXYrt/YwX/l9XJjs= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-Z-DH75bJPN25D4f4RqRWsQ-1; Thu, 13 Feb 2020 16:31:57 -0500 Received: by mail-wr1-f71.google.com with SMTP id w17so2971495wrr.9 for ; Thu, 13 Feb 2020 13:31:57 -0800 (PST) Received: from barrymore.redhat.com ([193.85.242.99]) by smtp.gmail.com with ESMTPSA id m9sm4410810wrx.55.2020.02.13.13.31.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 13:31:54 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [committed] c++: Fix useless using-declaration. Date: Thu, 13 Feb 2020 22:31:53 +0100 Message-Id: <20200213213153.9657-1-jason@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes Here reintroducing the same declarations into the global namespace via using-declaration is useless but OK. And a function and a function template with the same parameters do not conflict. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog 2020-02-13 Jason Merrill PR c++/93713 * name-lookup.c (matching_fn_p): A function does not match a template. --- gcc/cp/name-lookup.c | 6 ++++-- gcc/testsuite/g++.dg/lookup/using62.C | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lookup/using62.C base-commit: 613c932f5e5c0cc2e4b88e21d9870fa7b1a6ce5d diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 2a9bae53162..e5638d2df91 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2321,12 +2321,14 @@ update_local_overload (cxx_binding *binding, tree newval) static bool matching_fn_p (tree one, tree two) { + if (TREE_CODE (one) != TREE_CODE (two)) + return false; + if (!compparms (TYPE_ARG_TYPES (TREE_TYPE (one)), TYPE_ARG_TYPES (TREE_TYPE (two)))) return false; - if (TREE_CODE (one) == TEMPLATE_DECL - && TREE_CODE (two) == TEMPLATE_DECL) + if (TREE_CODE (one) == TEMPLATE_DECL) { /* Compare template parms. */ if (!comp_template_parms (DECL_TEMPLATE_PARMS (one), diff --git a/gcc/testsuite/g++.dg/lookup/using62.C b/gcc/testsuite/g++.dg/lookup/using62.C new file mode 100644 index 00000000000..e7a952ace08 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using62.C @@ -0,0 +1,3 @@ +template T bar (); +void bar () {} +using :: bar;