diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-02 00:26:17 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-11-02 00:26:17 +0100 |
commit | 8412b939d1cf375c8e478e39a5ac9d7260e4c23c (patch) | |
tree | fa30aa009dcb3b40d9e2996606c4f8ec9635d72e /gcc/cp/cp-tree.h | |
parent | 8a8ce49e0f3983e1b72f490a59ded92bca053c71 (diff) | |
download | gcc-8412b939d1cf375c8e478e39a5ac9d7260e4c23c.zip gcc-8412b939d1cf375c8e478e39a5ac9d7260e4c23c.tar.gz gcc-8412b939d1cf375c8e478e39a5ac9d7260e4c23c.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 42d5111..6c9731f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -448,6 +448,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; LAMBDA_EXPR_CAPTURE_OPTIMIZED (in LAMBDA_EXPR) IMPLICIT_CONV_EXPR_BRACED_INIT (in IMPLICIT_CONV_EXPR) TINFO_VAR_DECLARED_CONSTINIT (in TEMPLATE_INFO) + CALL_FROM_NEW_OR_DELETE_P (in CALL_EXPR) 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). ICS_BAD_FLAG (in _CONV) FN_TRY_BLOCK_P (in TRY_BLOCK) @@ -3791,6 +3792,11 @@ struct GTY(()) lang_decl { should be performed at instantiation time. */ #define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE)) +/* In a CALL_EXPR, true for allocator calls from new or delete + expressions. */ +#define CALL_FROM_NEW_OR_DELETE_P(NODE) \ + TREE_LANG_FLAG_2 (CALL_EXPR_CHECK (NODE)) + /* True if the arguments to NODE should be evaluated in left-to-right order regardless of PUSH_ARGS_REVERSED. */ #define CALL_EXPR_ORDERED_ARGS(NODE) \ |