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 DD2F43858D39 for ; Wed, 28 Feb 2024 14:54:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD2F43858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DD2F43858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709132068; cv=none; b=brI6c9IYOlTOkFwtk5Vv78aj8N7OqGPq1KrjP7DTDJCVinOhDb4ZhARubm9mgFtCBOkCYHopiZ0e3OOwtKyTreLQ0kl3KBn/GwjkbOoLFqEgh7tW75PLjf9VTwgdEYkiKC+OOQFcfx7I5MIdNl6Q3k9AmOGdwWxp8O7lKSWB9Ig= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709132068; c=relaxed/simple; bh=zIdjegUKab30fPKjkCWK6BJx1zhCt+jxYXO6QPhJYbQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=AsmhYGVetTYDa/sGyBAGLTfGsDe0hqS+W4JoE2osPGTB8lL4ceKW35um0+9NzEfVer/+FD8v5MpZkkPFTZ9T+sVZVwy47XjjrIez/P5bVJRbvmt8uCF3DHMOIF/sYLNTYGmk4v5cSJDk/INzLMz+yXsNb3tWf2FES+tV3OVvrCo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709132066; 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: in-reply-to:in-reply-to:references:references; bh=0OwiU+afUYZZODqo8fp8CDvQmzqfGf0rvGMSDUG+Dk8=; b=dh4bez6kIKeTe9UTCZRUPAwJ2bftrudWInK3hy8D2mXL8+e1a0EQXEcMr64dN4mNgvDD0O JHQ5VajtHCamc6tls4Rt5FHXpd2qJvyLEmZVbs5aaAoFjTNNqxpBXrvpo1L7QUtBRw5uLd V1PP66Kq7EmQM9sa2Dhiw8U338+W/yM= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-nM6V-HpcMpKJv2GI_P7Vrw-1; Wed, 28 Feb 2024 09:54:24 -0500 X-MC-Unique: nM6V-HpcMpKJv2GI_P7Vrw-1 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-dc6dbdcfd39so9479346276.2 for ; Wed, 28 Feb 2024 06:54:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709132064; x=1709736864; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0OwiU+afUYZZODqo8fp8CDvQmzqfGf0rvGMSDUG+Dk8=; b=dDz4k+Ar4j/Y3WuZdHH28ZIvJyML6jhdCgITwcRPTvhNNRMj9pT/AQxGBx9AuEezB7 K0t5W678KM7WLKc0s0sGvYZo/Gx69wzwUTxZdXw3vkjuniIw9GizwPFwWt9EstSls/hP le/6ctNwK+/Ix92VAt20cMzpFWWgxckxBKnaQL+mUOg8jtZx6C+6994pLhmqNoAtR2YW 0F2v6r6hFsvIKvn/IrjIY4CYZhtVoiSHXSkrHCU/Y6TIAcbm1J8f+preFdmtEuYz0KNC GAuh7S6wzRNFheKzpkgIsINB6uJPEmwVKkCZYTuyoAQTkc/REQhmLWI/qdyoT71Wvo3v 7RZA== X-Gm-Message-State: AOJu0YynguwNJXWOviO5MfqxsrEEb8HDecXoBoNLmbGV7X/Dv/QVFcgj YXjfWs6/sZhuVNO1r8aH2TcsVod+q1VbKp7DKG2XkK5IpBMxlIse0tzLwIYUYmaGAzv35sePYHt jZVCosBgiCZzYK+nKR+6Oev6ylaYQ3qNSZTB3Mjq1iDtZ2OsrCITjkaogVjyF+BO0yNN+8Fn4l9 rNEtmyZjJkji2Z1fMiC7CBLOTXgZz24Mq+znI= X-Received: by 2002:a05:6902:2689:b0:dc6:6307:d188 with SMTP id dx9-20020a056902268900b00dc66307d188mr2837445ybb.25.1709132064364; Wed, 28 Feb 2024 06:54:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWCMEUry7ZNe/jcgYKFgBFzmg3q6WpgVL56z6slzVX/7S9en+1dqChgV09FIxuP+EIdNTNKoOdLQnNybS/kls= X-Received: by 2002:a05:6902:2689:b0:dc6:6307:d188 with SMTP id dx9-20020a056902268900b00dc66307d188mr2837426ybb.25.1709132063956; Wed, 28 Feb 2024 06:54:23 -0800 (PST) MIME-Version: 1.0 References: <20240228145234.214146-1-jwakely@redhat.com> In-Reply-To: <20240228145234.214146-1-jwakely@redhat.com> From: Jonathan Wakely Date: Wed, 28 Feb 2024 14:54:08 +0000 Message-ID: Subject: Re: [committed] libstdc++: Fix noexcept on dtors in [PR114152] To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: __vic , victor@westerhu.is X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-12.3 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,T_SCC_BODY_TEXT_LINE,URI_HEX 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: Oops, sorry, I CC'd the wrong Victor on this patch (you've both reported libstdc++ bugs today and I grabbed the email address from the wrong browser tab). On Wed, 28 Feb 2024 at 14:53, Jonathan Wakely wrote: > > Tested x86_64-linux, pushed to trunk. Backport to gcc-13 to follow. > > -- >8 -- > > The PR points out that the destructors all have incorrect > noexcept-specifiers. > > libstdc++-v3/ChangeLog: > > PR libstdc++/114152 > * include/experimental/scope (scope_exit scope_fail): Make > destructor unconditionally noexcept. > (scope_sucess): Fix noexcept-specifier. > * testsuite/experimental/scopeguard/114152.cc: New test. > --- > libstdc++-v3/include/experimental/scope | 6 ++--- > .../experimental/scopeguard/114152.cc | 24 +++++++++++++++++++ > 2 files changed, 27 insertions(+), 3 deletions(-) > create mode 100644 libstdc++-v3/testsuite/experimental/scopeguard/114152.cc > > diff --git a/libstdc++-v3/include/experimental/scope b/libstdc++-v3/include/experimental/scope > index 5dbeac14795..ea273e8c095 100644 > --- a/libstdc++-v3/include/experimental/scope > +++ b/libstdc++-v3/include/experimental/scope > @@ -97,7 +97,7 @@ namespace experimental::inline fundamentals_v3 > scope_exit& operator=(const scope_exit&) = delete; > scope_exit& operator=(scope_exit&&) = delete; > > - ~scope_exit() noexcept(noexcept(this->_M_exit_function)) > + ~scope_exit() noexcept > { > if (_M_execute_on_destruction) > _M_exit_function(); > @@ -157,7 +157,7 @@ namespace experimental::inline fundamentals_v3 > scope_fail& operator=(const scope_fail&) = delete; > scope_fail& operator=(scope_fail&&) = delete; > > - ~scope_fail() noexcept(noexcept(this->_M_exit_function)) > + ~scope_fail() noexcept > { > if (std::uncaught_exceptions() > _M_uncaught_init) > _M_exit_function(); > @@ -211,7 +211,7 @@ namespace experimental::inline fundamentals_v3 > scope_success& operator=(const scope_success&) = delete; > scope_success& operator=(scope_success&&) = delete; > > - ~scope_success() noexcept(noexcept(this->_M_exit_function)) > + ~scope_success() noexcept(noexcept(this->_M_exit_function())) > { > if (std::uncaught_exceptions() <= _M_uncaught_init) > _M_exit_function(); > diff --git a/libstdc++-v3/testsuite/experimental/scopeguard/114152.cc b/libstdc++-v3/testsuite/experimental/scopeguard/114152.cc > new file mode 100644 > index 00000000000..63c1f710e9f > --- /dev/null > +++ b/libstdc++-v3/testsuite/experimental/scopeguard/114152.cc > @@ -0,0 +1,24 @@ > +// { dg-do compile { target c++20 } } > + > +// PR libstdc++/114152 > +// Wrong exception specifiers for LFTSv3 scope guard destructors > + > +#include > + > +using namespace std::experimental; > + > +struct F { > + void operator()() noexcept(false); > +}; > + > +static_assert( noexcept(std::declval&>().~scope_exit()) ); > +static_assert( noexcept(std::declval&>().~scope_fail()) ); > +static_assert( ! noexcept(std::declval&>().~scope_success()) ); > + > +struct G { > + void operator()() noexcept(true); > +}; > + > +static_assert( noexcept(std::declval&>().~scope_exit()) ); > +static_assert( noexcept(std::declval&>().~scope_fail()) ); > +static_assert( noexcept(std::declval&>().~scope_success()) ); > -- > 2.43.0 >