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 61E37395A060 for ; Wed, 16 Nov 2022 13:20:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 61E37395A060 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=1668604840; 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=lnfT9oE1uJhpwfYUbxaMeBxkqEYPl5IwFYpnKZ2NY20=; b=FutMmYOk4XdtRCZCEF0ndt0A9djuVyxbh2yJbjJ7u+C+aJtJgNBOx/YwqWFjjoJcX5ximo kjR+HBQIGBjd3ZI4cW/WI5fcFK2oOYqBBhVfhJkMdj9CjWyYUWJXgmmxrh/p72ZHXdnUbS 6kk7NCEGUG/zwSlesz2WCC8ez1xNsEc= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-542-H63oKsi9MtW9qrCbQqKxdg-1; Wed, 16 Nov 2022 08:20:36 -0500 X-MC-Unique: H63oKsi9MtW9qrCbQqKxdg-1 Received: by mail-qv1-f70.google.com with SMTP id mh13-20020a056214564d00b004c60dd95880so12054973qvb.6 for ; Wed, 16 Nov 2022 05:20:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc: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=lnfT9oE1uJhpwfYUbxaMeBxkqEYPl5IwFYpnKZ2NY20=; b=JnFxPlDp6gJtljp5U6M1/sM6EOc4tlBxXUY1o5dQrdfhW5qWfv5SvNPk71L0x5IgW5 Rrz53FtFwcK06qRetxGxz7EXp5QhgssVYdKZF9VZTbtdlw7Jc5DuekscyvIE1lFql4Cr CfPDGt5Mmd8TdWbGybWsek6NLyUR4xXRm4/v10zJiduwjND1kL+s0reqxlPHKf9GLaD7 2BpW4MZzsWu5nsYK7dj3U/T+JHIIk9f++f8ExWAT4ztT+deijP9r2Baya/lLUJ7mLBym q/TBFWNb9NiFeqWf24ZZPW225qErw8G8osL7kkQd5slQoFlhGlKtP79KZjcgnhuOrFRy zI3g== X-Gm-Message-State: ANoB5pk07mEgvGsEfX9jFmZB7FoXf6PpBkM/JZZG+VrtqP7YOQSMIlOV bwNA67GpJKcP/wt/aL2jP3J0RxCduGCe9UQT/k+VzGXDjVEUzaV1KPckRBkqwuwaZ2kfw7xZmj2 xzYFY80u3vzCLFETUrg== X-Received: by 2002:ac8:6642:0:b0:39a:c6ac:fd49 with SMTP id j2-20020ac86642000000b0039ac6acfd49mr20813396qtp.201.1668604835880; Wed, 16 Nov 2022 05:20:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf6wjEVMF4ONgU0Qq6Vbxg5ztq4xTWst83vxpsXi/WcOwMErFXUZArg4ZZurSJeWt8HiZjkOGg== X-Received: by 2002:ac8:6642:0:b0:39a:c6ac:fd49 with SMTP id j2-20020ac86642000000b0039ac6acfd49mr20813375qtp.201.1668604835595; Wed, 16 Nov 2022 05:20:35 -0800 (PST) Received: from [192.168.1.101] (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 m22-20020a05620a291600b006fa43e139b5sm10188805qkp.59.2022.11.16.05.20.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Nov 2022 05:20:34 -0800 (PST) Message-ID: Date: Wed, 16 Nov 2022 08:20:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] c++, v2: Implement C++23 P2647R1 - Permitting static constexpr variables in constexpr functions To: Jakub Jelinek , Jonathan Wakely Cc: gcc-patches@gcc.gnu.org, Marek Polacek References: From: Jason Merrill In-Reply-To: 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=-6.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,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 11/16/22 01:19, Jakub Jelinek wrote: > On Wed, Nov 16, 2022 at 12:27:02AM +0000, Jonathan Wakely wrote: >> On Tue, 15 Nov 2022 at 23:50, Jakub Jelinek wrote: >>> >>> On Tue, Nov 15, 2022 at 06:36:38PM -0500, Jason Merrill wrote: >>>>> Here is an updated patch that passed bootstrap/regtest, the only >>>>> change is another testcase tweak. >>>>> >>>>> 2022-11-13 Jakub Jelinek >>>>> >>>>> gcc/c-family/ >>>>> * c-cppbuiltin.cc (c_cpp_builtins): Bump __cpp_constexpr >>>>> value from 202207L to 202211L. >>>>> gcc/cp/ >>>>> * constexpr.cc (cxx_eval_constant_expression): Implement C++23 >>>>> P2647R1 - Permitting static constexpr variables in constexpr functions. >>>>> Allow decl_maybe_constant_var_p static or thread_local vars for >>>>> C++23. >>>> >>>> This was accepted as a DR, so it shouldn't be limited to C++23 mode. >>>> Certainly it should be allowed in C++20 mode; I don't have a strong opinion >>>> about C++14/17. Jonathan, do you? >>> >>> How will a feature with feature test macro with multiple values work as DR? >>> Or will everything but the macro be treated as a DR (so __cpp_constexpr >= >>> 202211L only for C++23)? >> >> Yes, I think so. We just won't be able to advertise this feature as >> supported in C++20. > > Ok. But there is another issue, the > https://eel.is/c++draft/expr.const#5.2 > spot that P2647R1 is changing didn't exist in C++20, it was only added with > P2242R3. So, if one would treat P2647R1 as a DR for C++20, one has to come up with > a different standard modification. > Probably change the last bullet of: > [dcl.constexpr]/3 > its function-body shall not enclose > > a goto statement, > an identifier label, > a definition of a variable of non-literal type or of static or thread storage duration. > to > a definition of a variable of non-literal type or of a non-constexpr > variable of static or thread storage duration. > or so. Indeed, though the hypothetical C++20 change could still use the "usable in constant expressions" phrase. Jason