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.133.124]) by sourceware.org (Postfix) with ESMTPS id 2B2113858D32 for ; Thu, 10 Aug 2023 17:22:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B2113858D32 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=1691688165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QmUBUSOxclW6VTKuGgEjWnpIeoMvOmyxdARfMXjBrhY=; b=R4Tcalfwx68QCpiG1JbaR0M12lKRSiPDzJyx0oOoIsPwuzoT+TqDELBvsuy9cnpYqjxFGX gmgSj6QCghf2QjYjBkdcUuk7w0kSFFdrEMAM4oTsfkpZu58ov2lqE/Aj2w79BKQ4fEIejS k/Z99HCgHeUMLKI6Bsj+8lVSigauVSA= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-64-prixcC3XN1yyVpgmSgu68g-1; Thu, 10 Aug 2023 13:22:41 -0400 X-MC-Unique: prixcC3XN1yyVpgmSgu68g-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4100bd2f742so13536191cf.2 for ; Thu, 10 Aug 2023 10:22:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691688157; x=1692292957; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QmUBUSOxclW6VTKuGgEjWnpIeoMvOmyxdARfMXjBrhY=; b=fjkbf7/CNyWuA6lodc10UBAUlu5CGBB7qg04HndV3YLFHTRwomu8i6AfZUioJqCW6I 2HccCfF8ufuQqzOFdVAuewG/LAxawzYB4urlS0USFEkM6Q7y17AdncF+vNp17OeU3kH7 PpT9h9FnNwRtnu+He8E4f54A3gAJvv7AZ+BkTq6c6+N+bpY98gr43k9b5dnVNKdvOr9y u37GiVB12RxnQxuIzX3pNdAROU/q11tmGuPFS1ihYQB+j3w9AlBOxB53vtIjVbTCfCFQ 8RQ+P/DBsoo/pIbEUAAsP4xvZWPaUVTeYJlna5vCFzZmpJBAFeomrDXD7xrH3vKI/T5a yYHg== X-Gm-Message-State: AOJu0YyiPycHLNE6V6+S2C/HA8BNd26sDL4OZaVLhQs1YuQ4ErLNZp0Z gEFzlURjeQtvOLV8G/gQjKHBEyX4tuQKbJBk+n8Xo18dj5FrSr3bRo05No2oRHtHZysHeu3hEO0 EUg5Xyz80tavbh+UOgQ== X-Received: by 2002:ac8:7c45:0:b0:403:b252:96ea with SMTP id o5-20020ac87c45000000b00403b25296eamr4207221qtv.21.1691688156864; Thu, 10 Aug 2023 10:22:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6ZqLLci7UWkdNRCpkHyW7lnvYKzgdj81IVQSwXI10qfa89OxD9MZOA3eMUEktiwKDnRDcAQ== X-Received: by 2002:ac8:7c45:0:b0:403:b252:96ea with SMTP id o5-20020ac87c45000000b00403b25296eamr4207202qtv.21.1691688156559; Thu, 10 Aug 2023 10:22:36 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id o2-20020ac841c2000000b004035b79860dsm620880qtm.81.2023.08.10.10.22.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Aug 2023 10:22:35 -0700 (PDT) Message-ID: <932df809-cf99-57ac-b285-75c7cec8f6eb@redhat.com> Date: Thu, 10 Aug 2023 13:22:34 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] c++: bogus warning w/ deduction guide in anon ns [PR106604] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20230810160900.1513252-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20230810160900.1513252-1-ppalka@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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: On 8/10/23 12:09, Patrick Palka wrote: > Booststrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk and perhaps 13? > > -- >8 -- > > We shouldn't issue a "declared static but never defined" warning > for a deduction guide (declared in an anonymous namespace). > > PR c++/106604 > > gcc/cp/ChangeLog: > > * decl.cc (wrapup_namespace_globals): Don't issue a > -Wunused-function warning for a deduction guide. Maybe instead of special casing this here we could set DECL_INITIAL on deduction guides so they look defined? > gcc/testsuite/ChangeLog: > > * g++.dg/cpp1z/class-deduction116.C: New test. > --- > gcc/cp/decl.cc | 1 + > gcc/testsuite/g++.dg/cpp1z/class-deduction116.C | 8 ++++++++ > 2 files changed, 9 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction116.C > > diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc > index 792ab330dd0..9fe3a0b98fd 100644 > --- a/gcc/cp/decl.cc > +++ b/gcc/cp/decl.cc > @@ -856,6 +856,7 @@ wrapup_namespace_globals () > && !TREE_PUBLIC (decl) > && !DECL_ARTIFICIAL (decl) > && !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl) > + && !deduction_guide_p (decl) > && !warning_suppressed_p (decl, OPT_Wunused_function)) > warning_at (DECL_SOURCE_LOCATION (decl), > OPT_Wunused_function, > diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction116.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction116.C > new file mode 100644 > index 00000000000..00f6d5fef41 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction116.C > @@ -0,0 +1,8 @@ > +// PR c++/106604 > +// { dg-do compile { target c++17 } } > +// { dg-additional-options "-Wunused-function" } > + > +namespace { > + template struct A { A(...); }; > + A(bool) -> A; // { dg-bogus "never defined" } > +}