From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ; Thu, 23 Mar 2023 21:18:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 783F03858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679606293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7eyHBgM6ze5nmX9/rUPTioLS0SiM/2R3T6eebV0Gwok=; b=VJeiZZNzd9fyMso6XFZx8hcpEFfSJIgsjevmez0v3Kn0BALG03YsApr9I5xMuMIndtVSJC xcEq/673vl1CKylBzTL42F55tGnnfAS2hdK/NTtD7AdqoZK8yw1Z4+IUCDMKq6DjVRW/r+ EHrdoL254g/mHx+hB3FgftNdRb31+JE= 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 ; 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-Google-Smtp-Source: AKy350Y/grma0O+GzgDFVG0Ai9fFBXYDTCYnc8rP+DfSWSKTTjCofq4t5BLbR1B0N2UMiiuYVFV3Eg== 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) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka 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 List-Id: 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) : 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 +void f(T t) { foo(t); } // { dg-bogus "deleted function.*deleted function" } + // { dg-error "deleted function" "" { target *-*-*} .-1 } + +template void f(int); -- 2.40.0.130.g27d43aaaf5