PR c++/91369 - Implement P0784R7: constexpr new
authorJakub Jelinek <jakub@redhat.com>
Fri, 1 Nov 2019 23:26:17 +0000 (00:26 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 1 Nov 2019 23:26:17 +0000 (00:26 +0100)
commit8412b939d1cf375c8e478e39a5ac9d7260e4c23c
treefa30aa009dcb3b40d9e2996606c4f8ec9635d72e
parent8a8ce49e0f3983e1b72f490a59ded92bca053c71
PR c++/91369 - Implement P0784R7: constexpr new

PR c++/91369 - Implement P0784R7: constexpr new
* cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
* init.c (build_new_1, build_vec_delete_1, build_delete): Set
CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
* constexpr.c (is_std_allocator_allocate): Only allow
global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
or in std::allocate<T>::{,de}allocate.
(potential_constant_expression_1): Likewise.

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

From-SVN: r277732
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/cp-tree.h
gcc/cp/init.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/constexpr-new6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/constexpr-new7.C [new file with mode: 0644]