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 ADB883858412 for ; Tue, 7 Mar 2023 14:55:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADB883858412 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=1678200911; 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=6C9/Ve627ZmmT/ZYda6PPQqolg62EFwN5ffKjCE7Gow=; b=J9rVyZzcqpC3r9b3beo0FK7/7sgFnbz8URfAgAELUg09nkuHAkycoL+AuLuJo678JnNRLq /gCVi9EJKu8W7fnKhW8u0d4IIvsquWHGUIn1+2aTFxKCi31mLNopnK37dYhuqlTIgwKf7j /p1XIeFh1W9PNh8s4UD6Sv1TWtimdJo= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-YVcKF_UxMk-nKi3TpUzgLA-1; Tue, 07 Mar 2023 09:55:10 -0500 X-MC-Unique: YVcKF_UxMk-nKi3TpUzgLA-1 Received: by mail-qv1-f71.google.com with SMTP id ge13-20020a05621427cd00b005739f5f9d7cso7546346qvb.22 for ; Tue, 07 Mar 2023 06:55:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678200909; 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=6C9/Ve627ZmmT/ZYda6PPQqolg62EFwN5ffKjCE7Gow=; b=UDXpiOn7JB26uZ6xLc+uSLVmfQTxeVQHuUpdyE0xrHg5kUDx+e+c8Vbj1WZFRcNt+s r9+rlEBS56PPRXiVJpNikcQI2NFtt+MTVSbmFCaJTbmQLZf4XEqzMP/Ol12QZRMdwZZ7 UOVC/oebMHkpFtgih+zM4D4ZFZ4YtGrKLCMHZW2TOfHe6Tk+RZVvsSZoJroHiowWg24g gkg/9uArsOi0EorebhoSnLPQcEjiL6rfpL5a48NL+bBq1MnDLQ8KhdPkAhvgQUg7jgcr xlbVXF3nOCnWj7ollqZUOQlCZBMR73vyuxZO5SyAaKuo04x2X3CblNu7Z/JWVcIpB0Ps w9wA== X-Gm-Message-State: AO0yUKWcuqQAn5vspslepwQTamxIfZum1bkmiGMD/cKqyRUsXwNeUn/0 qbOQntwyQ+M7hS98Ppfc4ZYowXcK7dACAoe/NwiIz6G9ZvYytFoW9Rmj9gpr87l+Vl8JR48elyC X9rZgrYvo29qz5CHDWnFhibzfCg== X-Received: by 2002:ac8:5acd:0:b0:3b6:2e12:4d25 with SMTP id d13-20020ac85acd000000b003b62e124d25mr22907761qtd.31.1678200909396; Tue, 07 Mar 2023 06:55:09 -0800 (PST) X-Google-Smtp-Source: AK7set9QmL+jZHkp4pds/J+vLViMRcQ6SFpz99D07o3fAhOrJPZdU/w+HFqZIdjcFi8Sy+i+N73TIg== X-Received: by 2002:ac8:5acd:0:b0:3b6:2e12:4d25 with SMTP id d13-20020ac85acd000000b003b62e124d25mr22907557qtd.31.1678200906822; Tue, 07 Mar 2023 06:55:06 -0800 (PST) Received: from [192.168.1.108] (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 z22-20020ac84556000000b003bfc2d5ddb7sm9611064qtn.73.2023.03.07.06.55.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Mar 2023 06:55:06 -0800 (PST) Message-ID: <1db0f19a-3394-03dd-94f4-24bf59b94881@redhat.com> Date: Tue, 7 Mar 2023 09:55:04 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] c++: noexcept and copy elision [PR109030] To: Marek Polacek , GCC Patches References: <20230306235957.390533-1-polacek@redhat.com> From: Jason Merrill In-Reply-To: <20230306235957.390533-1-polacek@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.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_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: On 3/6/23 18:59, Marek Polacek wrote: > When processing a noexcept, constructors aren't elided: build_over_call > has > /* It's unsafe to elide the constructor when handling > a noexcept-expression, it may evaluate to the wrong > value (c++/53025). */ > && (force_elide || cp_noexcept_operand == 0)) > so the assert I added recently needs to be relaxed a little bit. > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. > PR c++/109030 > > gcc/cp/ChangeLog: > > * constexpr.cc (cxx_eval_call_expression): Relax assert. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp0x/noexcept77.C: New test. > --- > gcc/cp/constexpr.cc | 6 +++++- > gcc/testsuite/g++.dg/cpp0x/noexcept77.C | 9 +++++++++ > 2 files changed, 14 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept77.C > > diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc > index 364695b762c..5384d0e8e46 100644 > --- a/gcc/cp/constexpr.cc > +++ b/gcc/cp/constexpr.cc > @@ -2869,7 +2869,11 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, > > /* We used to shortcut trivial constructor/op= here, but nowadays > we can only get a trivial function here with -fno-elide-constructors. */ > - gcc_checking_assert (!trivial_fn_p (fun) || !flag_elide_constructors); > + gcc_checking_assert (!trivial_fn_p (fun) > + || !flag_elide_constructors > + /* We don't elide constructors when processing > + a noexcept-expression. */ > + || cp_noexcept_operand); > > bool non_constant_args = false; > new_call.bindings > diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept77.C b/gcc/testsuite/g++.dg/cpp0x/noexcept77.C > new file mode 100644 > index 00000000000..16db8eb79ee > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept77.C > @@ -0,0 +1,9 @@ > +// PR c++/109030 > +// { dg-do compile { target c++11 } } > + > +struct foo { }; > + > +struct __as_receiver { > + foo empty_env; > +}; > +void sched(foo __fun) noexcept(noexcept(__as_receiver{__fun})) { } > > base-commit: dfb14cdd796ad9df6b5f2def047ef36b29385902