]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: always check consteval address
authorJason Merrill <jason@redhat.com>
Tue, 9 May 2023 22:48:11 +0000 (18:48 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 10 May 2023 15:09:56 +0000 (11:09 -0400)
commit688fdde2f18e3318ef7e9889fdb9b239b905dfc7
treebdec6a44678c94b6d22f8ffa400506a32fa64e4c
parenta056a9868e6ecab24b0b7e4e12e846097b8c8fb0
c++: always check consteval address

The restriction on the "permitted result of a constant expression" to not
refer to an immediate function applies regardless of context.  The previous
code tried to only check in cases where we wouldn't get the check in
cp_fold_r, but with the next patch I would need to add another case and it
shouldn't be a problem to always check.

We also shouldn't talk about immediate evaluation when we aren't dealing
with one.

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_outermost_constant_expr): Always check
for address of immediate fn.
(maybe_constant_init_1): Evaluate PTRMEM_CST.

gcc/testsuite/ChangeLog:

* g++.dg/DRs/dr2478.C: Handle -fimplicit-constexpr.
* g++.dg/cpp23/consteval-if12.C: Adjust diagnostics.
* g++.dg/cpp2a/consteval20.C: Likewise.
* g++.dg/cpp2a/consteval24.C: Likewise.
* g++.dg/cpp2a/srcloc20.C: Likewise.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/DRs/dr2478.C
gcc/testsuite/g++.dg/cpp23/consteval-if12.C
gcc/testsuite/g++.dg/cpp2a/consteval20.C
gcc/testsuite/g++.dg/cpp2a/consteval24.C
gcc/testsuite/g++.dg/cpp2a/srcloc20.C