From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB2BF3858D28; Sat, 19 Nov 2022 09:21:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB2BF3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668849715; bh=y/TfF0nvUz2SOko4xk2cmps3F6GC0Jr5P/RfNE7+6R8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=t3EneV6x+hNkR5FfVdYbMjbzxoT1hQ5qGv8E8RHP+asDKl75EFgQuzRaxexx55VUl ZFS+2tT2/DXzYk65Oe0Jl8iZPfiGX88vcUchC9vITK+3KT/sZw8tlpy2oMx4MYA+rV UwsEjCY7UFKsI6ilyTO+YQr/YnDntcw3EuQbcbY4= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107685] [C++23] P2647 - Permitting static constexpr variables in constexpr functions Date: Sat, 19 Nov 2022 09:21:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107685 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #2 from Jakub Jelinek --- https://gcc.gnu.org/g:32d16fe9d7e347bc58e7fad316ed7923e1d0f65c commit r13-4161-g32d16fe9d7e347bc58e7fad316ed7923e1d0f65c Author: Jakub Jelinek Date: Sat Nov 19 09:26:44 2022 +0100 c++: Implement C++23 P2647R1 - Permitting static constexpr variables in constexpr functions The following patch implements this paper. Per further discussions it is implemented for C++23 only, so isn't treated as a DR, e.g. because the part of the standard the paper is changing didn't even exist in C++20. And we gave up on trying to implement it as a pedwarn rather than error for C++20 and older, because of implicit constexpr lambdas or -fimplicit-constexpr reasons. For C++20 and older, the only change is that passing through definitions of static or thread_local vars usable in constant expressio= ns is now accepted in statement expressions if they aren't inside of const= expr or consteval functions. 2022-11-19 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_EXPRs of decl_constant_var_p static or thread_local vars. (potential_constant_expression_1): Similarly, except use decl_maybe_constant_var_p instead of decl_constant_var_p if processing_template_decl. gcc/testsuite/ * g++.dg/cpp23/constexpr-nonlit17.C: New test. * g++.dg/cpp23/constexpr-nonlit18.C: New test. * g++.dg/cpp23/feat-cxx2b.C: Adjust expected __cpp_constexpr value. * g++.dg/ext/stmtexpr19.C: Don't expect an error. * g++.dg/ext/stmtexpr25.C: New test.=