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 AF19C3858D37 for ; Thu, 3 Feb 2022 20:26:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF19C3858D37 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-128-cGSWxH3eMmOV0PtgEh9SBw-1; Thu, 03 Feb 2022 15:26:55 -0500 X-MC-Unique: cGSWxH3eMmOV0PtgEh9SBw-1 Received: by mail-qv1-f69.google.com with SMTP id 6-20020a0562140d4600b004244d191fd4so3599039qvr.0 for ; Thu, 03 Feb 2022 12:26:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=H6mKuIdqi89ElwO5hqN7gLa/ARdzFHhMqFVu19qSO5M=; b=tvhsE305CaOcLJPs/C+aslJ3S3YpjHBN9JqfOxhEqgOVhXx9L8DiqjIAiHsY0TPAvM Wf5ZdvujKRaAkSARRz7HygjJSHHoVOeUH3bVktVfNx1ko9fjAC2gYdYE0Fnmyiu38cd2 +LdvClOsdR8AyxEoiBgGDlVaj7tF6PieC2bj08B6mwNiu1WsFfHCFlMZVKRhCijT0dPq vOCsaW7Nv1CkDFhAyd95UTqBHyjC55Z8UpElBbRU3DX2tlhby0uIPtEzs8wj7I8SLthz dXt8hQNeF2XQi4aSimA+2H23XwwrvWdYHnb3d44G4SLV+H4fDeOIkJEjc6fTt5wfJuBR NYXw== X-Gm-Message-State: AOAM5312vTuxEW3ikettBjtInhESuHBSDdfRYlDUavKhivz2vCDjFcJ/ 7QHb3s90vP2c4alS2IF89hE9d38ICV+Zb3DCE8SteiyfnaH9cxJ3X0+3hZ/AFAFNhFuGujFZB8W zbpoJ+uW7/bfOevmPJQ== X-Received: by 2002:ad4:5d66:: with SMTP id fn6mr33099262qvb.30.1643920014009; Thu, 03 Feb 2022 12:26:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvqCKqJ+DBa9jHoCjQpi9rqlm4bH+4hzBjDcrsQKZtKftLg1+RTHY7tSOvGRxPlhqkBx56sA== X-Received: by 2002:ad4:5d66:: with SMTP id fn6mr33099245qvb.30.1643920013720; Thu, 03 Feb 2022 12:26:53 -0800 (PST) Received: from [192.168.1.149] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id k6sm15359319qko.68.2022.02.03.12.26.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Feb 2022 12:26:52 -0800 (PST) Message-ID: <152576a5-c950-b21c-edfd-a15a7b0305b3@redhat.com> Date: Thu, 3 Feb 2022 15:26:52 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH] c++: conditional noexcept-spec on defaulted comparison op [PR96242] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20220203195838.409426-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20220203195838.409426-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=-12.9 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_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2022 20:26:58 -0000 On 2/3/22 14:58, Patrick Palka wrote: > When synthesizing a defaulted comparison op from > maybe_instantiate_noexcept, we seem to be forgetting to instantiate the > noexcept-spec afterwards. Hmm, there shouldn't be any need to instantiate the noexcept-spec afterwards, it should have been set by ~comp_info. > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk and perhaps 11? > > PR c++/96242 > > gcc/cp/ChangeLog: > > * pt.cc (maybe_instantiate_noexcept): Keep going after > successfully synthesizing a DECL_MAYBE_DELETED fn. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp2a/spaceship-synth15.C: New test. > --- > gcc/cp/pt.cc | 3 ++- > .../g++.dg/cpp2a/spaceship-synth15.C | 22 +++++++++++++++++++ > 2 files changed, 24 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-synth15.C > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index 6dd64101ced..03345ed3ed3 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -25986,7 +25986,8 @@ maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain) > ++function_depth; > maybe_synthesize_method (fn); > --function_depth; > - return !DECL_MAYBE_DELETED (fn); > + if (DECL_MAYBE_DELETED (fn)) > + return false; > } > > tree fntype = TREE_TYPE (fn); > diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth15.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth15.C > new file mode 100644 > index 00000000000..00ea6c10474 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth15.C > @@ -0,0 +1,22 @@ > +// PR c++/96242 > +// { dg-do compile { target c++20 } } > + > +#include > + > +template > +struct X { > + auto operator<=>(const X&) const noexcept(B) = default; > + bool operator==(const X&) const noexcept(!B) = default; > +}; > + > +X x_t; > +static_assert(noexcept(x_t <=> x_t)); > +static_assert(noexcept(x_t < x_t)); > +static_assert(!noexcept(x_t == x_t)); > +static_assert(!noexcept(x_t != x_t)); > + > +X x_f; > +static_assert(!noexcept(x_f <=> x_f)); > +static_assert(!noexcept(x_f < x_f)); > +static_assert(noexcept(x_f == x_f)); > +static_assert(noexcept(x_f != x_f));