]> git.ipfire.org Git - thirdparty/gcc.git/commit
re PR c++/91369 (Implement P0784R7: constexpr new)
authorJakub Jelinek <jakub@redhat.com>
Tue, 3 Dec 2019 19:27:47 +0000 (20:27 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 3 Dec 2019 19:27:47 +0000 (20:27 +0100)
commitee1de08d4d22648cf3168caa60e283135755da85
treee083274d278bc2660e28c8e0c3930a6bb161b171
parent21cd8589291a1b415106740acd56509e0143356d
re PR c++/91369 (Implement P0784R7: constexpr new)

PR c++/91369
* constexpr.c (struct constexpr_global_ctx): Add cleanups member,
initialize it in the ctor.
(cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT
is already in the values hash_map, don't evaluate it again.  Put
TARGET_EXPR_SLOT into hash_map even if not lval, and push it into
save_exprs too.  If there is TARGET_EXPR_CLEANUP and not
CLEANUP_EH_ONLY, push the cleanup to cleanups vector.
<case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to
local auto_vec, after evaluating the body evaluate cleanups and
restore previous cleanups.
<case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE.
(cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec,
after evaluating the expression evaluate cleanups.

* g++.dg/cpp2a/constexpr-new8.C: New test.

From-SVN: r278945
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/constexpr-new8.C [new file with mode: 0644]