Message ID | 20230323211803.396326-2-ppalka@redhat.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp3139329wrt; Thu, 23 Mar 2023 14:19:52 -0700 (PDT) X-Google-Smtp-Source: AKy350bHcGKRcgWPG/BQioOaWVWOrS8eToBXUXhsXttNeL25dXHF1KIXU4NEkBQV9B1y48WT4k4b X-Received: by 2002:aa7:d313:0:b0:4f9:e6f1:5c7c with SMTP id p19-20020aa7d313000000b004f9e6f15c7cmr751530edq.32.1679606392752; Thu, 23 Mar 2023 14:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679606392; cv=none; d=google.com; s=arc-20160816; b=zx+HM4rxehieGxIu0UTIIk+dgB3GPTH6ry9xBty87EJ8fvDOJccoRN6p2lQhvE2zz6 vDXKA4I0smGUb298aV2Zy7V/k4adwnYXkE3IrlQRHAgo51b9Tt+dPwAkTLSUJyh2buwR /nA9iPyeEvtj9+P1khBEwQS2i1aVcdOeEOXTRAONCCuoIRw+mq08LQMw32Q6bxshK382 DE0d68XXbkFkihalnhKWnnHCshrJ617bhI1+4P6DdFG+jDidIt7KpKULr6SM6K8Pnpcj qvfFq5nokQomXXY9a7xASCdf6tqUdbNT74hHtwbnuq4OW/833VnxZRPN3+1+UoEwTHJe VH4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=7eyHBgM6ze5nmX9/rUPTioLS0SiM/2R3T6eebV0Gwok=; b=z8MsUGYe97Jd6JXiqcsztu7k1eBQZO2wLv5Uw/p9ATc2MKoxVS3zW7drrfjRVWhbOM gnGy1a1WJV5CQqNb5LR+i98fTOouQwKbX97Z6KFjAuW7D6k/eGd3M7VzqDmT+dGAzzFW fEZiJ4ZtThF39NMQZNC8totVl1WsXEnC9RwBCsOHpeBbcIQIJun3g5lb5Cy+oei5td+H gmWQv89njZHBivo0tuDOjXX42YhnLDGdm/n7giHjTPycIVyMLeGHCRcdPJN5PckBsVZM aosiFgoVlp0rZ81Eyql92/RAmDBhAgXLBTPGDxxeIIykbDeMFo2Yie+k8h2A5TvrtOT0 /7hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xohdAeSa; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k11-20020aa7d8cb000000b004ad05f8a5cbsi19894943eds.266.2023.03.23.14.19.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 14:19:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xohdAeSa; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BAAF3385417F for <ouuuleilei@gmail.com>; Thu, 23 Mar 2023 21:19:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAAF3385417F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679606391; bh=7eyHBgM6ze5nmX9/rUPTioLS0SiM/2R3T6eebV0Gwok=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xohdAeSaqayAaYQuRqz84OFvB48MCzv42T7+BNBPQLdCdjlnGoMtTy6KZnhOiFv6o u5tQfKQhCo23IV+8jQV1Vhl3fj+qZOQzjjT5wWJHv9zHH/Tl2uO/soLlANr95s1mM8 4JldUp04tDlL7lzh4u5NnOfHohdVZwillw3As56U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 783F03858CDB for <gcc-patches@gcc.gnu.org>; Thu, 23 Mar 2023 21:18:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 783F03858CDB Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-99-7FUZUzoFPLuK4D5MBUqjmg-1; Thu, 23 Mar 2023 17:18:11 -0400 X-MC-Unique: 7FUZUzoFPLuK4D5MBUqjmg-1 Received: by mail-qv1-f72.google.com with SMTP id px9-20020a056214050900b005d510cdfc41so70206qvb.7 for <gcc-patches@gcc.gnu.org>; Thu, 23 Mar 2023 14:18:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679606290; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7eyHBgM6ze5nmX9/rUPTioLS0SiM/2R3T6eebV0Gwok=; b=0Kv+mNrwdVjTmFCY+aHYeXaw4bYR2htAxIvnExOPNBruKDyEUO29U7cvKefxrxkng0 EvfmdieWVdvnrc0k0BXUGIQf8zQSzaihsK4pR8WYXPgBCuwifNpgGLINITfhIHiOhu+Q WLPsi+ip/4yMEzT6+bAVFEmYyG0wFFPjkIQ9JqrLpAZJqMAzOaxVse/1h/6FTWAjNPuc vu5THePi1Lud6kv0sW+w3CYM8w0mZ78Gb99oCjtT6EAvzDHI7wBcP+XNyXJIqSAyasoX QkxKP6s8kzqKh7kLt9IoiDXjli1aea6JSOfL+G/MaAEiG9wqMi5uPqpBlSyFr3WIYubJ 1EPg== X-Gm-Message-State: AAQBX9cbMBkMhgDcEPcb6IHHiH1dal7v2Fbc02IkhWN3aVXZAYYrYLt6 HIP8HkzIHq6o2pMQEKy+XrGKN78+JcbatULcrEhnuMvfflbdyg6DFqUDrJrrM7JlafPS69l1/So gaQ1BrAAv1eiaNtM/+DoLP7WpQ5snjtONVCPq/BX1RlcpLeHAgDSrPjT6hpExEwo1NBPdqcm/JT U= X-Received: by 2002:a05:6214:2507:b0:56e:bc62:e151 with SMTP id gf7-20020a056214250700b0056ebc62e151mr683046qvb.7.1679606289721; Thu, 23 Mar 2023 14:18:09 -0700 (PDT) X-Received: by 2002:a05:6214:2507:b0:56e:bc62:e151 with SMTP id gf7-20020a056214250700b0056ebc62e151mr683015qvb.7.1679606289398; Thu, 23 Mar 2023 14:18:09 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id w10-20020a0cff0a000000b005dd8b934585sm159174qvt.29.2023.03.23.14.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 14:18:09 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka <ppalka@redhat.com> Subject: [PATCH 2/2] c++: duplicate "use of deleted fn" diagnostic [PR106880] Date: Thu, 23 Mar 2023 17:18:03 -0400 Message-Id: <20230323211803.396326-2-ppalka@redhat.com> X-Mailer: git-send-email 2.40.0.130.g27d43aaaf5 In-Reply-To: <20230323211803.396326-1-ppalka@redhat.com> References: <20230323211803.396326-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Patrick Palka via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Patrick Palka <ppalka@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761194952686516629?= X-GMAIL-MSGID: =?utf-8?q?1761194952686516629?= |
Series |
[1/2] c++: improve "NTTP argument considered unused" fix [PR53164, PR105848]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Patrick Palka
March 23, 2023, 9:18 p.m. UTC
Here we're issuing a duplicate diagnostic for the use of the deleted foo, first from the CALL_EXPR case of tsubst_copy_and_build (which doesn't exit early upon failure), and again from from build_over_call when rebuilding the substituted CALL_EXPR. We can fix this by exiting early upon failure of the first call, but this first call should always be redundant since build_over_call (or another subroutine of finish_call_expr) ought to reliably call mark_used for a suitable DECL_P callee anyway. So this patch just gets rid of the first call to mark_used. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? PR c++/106880 gcc/cp/ChangeLog: * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Don't call mark_used. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/deleted16.C: New test. --- gcc/cp/pt.cc | 6 ------ gcc/testsuite/g++.dg/cpp0x/deleted16.C | 11 +++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/deleted16.C
Comments
On 3/23/23 17:18, Patrick Palka wrote: > Here we're issuing a duplicate diagnostic for the use of the deleted > foo, first from the CALL_EXPR case of tsubst_copy_and_build (which > doesn't exit early upon failure), and again from from build_over_call > when rebuilding the substituted CALL_EXPR. > > We can fix this by exiting early upon failure of the first call, but > this first call should always be redundant since build_over_call (or > another subroutine of finish_call_expr) ought to reliably call mark_used > for a suitable DECL_P callee anyway. > > So this patch just gets rid of the first call to mark_used. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? OK. > PR c++/106880 > > gcc/cp/ChangeLog: > > * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Don't call > mark_used. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp0x/deleted16.C: New test. > --- > gcc/cp/pt.cc | 6 ------ > gcc/testsuite/g++.dg/cpp0x/deleted16.C | 11 +++++++++++ > 2 files changed, 11 insertions(+), 6 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/cpp0x/deleted16.C > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index 9b3cc33331c..060d2d38504 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -21176,12 +21176,6 @@ tsubst_copy_and_build (tree t, > } > } > > - /* Remember that there was a reference to this entity. */ > - if (function != NULL_TREE > - && DECL_P (function) > - && !mark_used (function, complain) && !(complain & tf_error)) > - RETURN (error_mark_node); > - > if (!maybe_fold_fn_template_args (function, complain)) > return error_mark_node; > > diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted16.C b/gcc/testsuite/g++.dg/cpp0x/deleted16.C > new file mode 100644 > index 00000000000..93cfb51eb3d > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp0x/deleted16.C > @@ -0,0 +1,11 @@ > +// PR c++/106880 > +// Verify we don't emit a "use of deleted function" diagnostic twice. > +// { dg-do compile { target c++11 } } > + > +void foo() = delete; > + > +template<class T> > +void f(T t) { foo(t); } // { dg-bogus "deleted function.*deleted function" } > + // { dg-error "deleted function" "" { target *-*-*} .-1 } > + > +template void f(int);
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 9b3cc33331c..060d2d38504 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -21176,12 +21176,6 @@ tsubst_copy_and_build (tree t, } } - /* Remember that there was a reference to this entity. */ - if (function != NULL_TREE - && DECL_P (function) - && !mark_used (function, complain) && !(complain & tf_error)) - RETURN (error_mark_node); - if (!maybe_fold_fn_template_args (function, complain)) return error_mark_node; diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted16.C b/gcc/testsuite/g++.dg/cpp0x/deleted16.C new file mode 100644 index 00000000000..93cfb51eb3d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/deleted16.C @@ -0,0 +1,11 @@ +// PR c++/106880 +// Verify we don't emit a "use of deleted function" diagnostic twice. +// { dg-do compile { target c++11 } } + +void foo() = delete; + +template<class T> +void f(T t) { foo(t); } // { dg-bogus "deleted function.*deleted function" } + // { dg-error "deleted function" "" { target *-*-*} .-1 } + +template void f(int);