aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index aa48f80..e40afe2 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3058,6 +3058,10 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
complain);
}
+ if (!verify_type_context (input_location, TCTX_ALLOCATION, elt_type,
+ !(complain & tf_error)))
+ return error_mark_node;
+
if (variably_modified_type_p (elt_type, NULL_TREE) && (complain & tf_error))
{
error ("variably modified type not allowed in new-expression");
@@ -3942,6 +3946,10 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
if (base == error_mark_node || maxindex == error_mark_node)
return error_mark_node;
+ if (!verify_type_context (input_location, TCTX_DEALLOCATION, type,
+ !(complain & tf_error)))
+ return error_mark_node;
+
if (!COMPLETE_TYPE_P (type))
{
if (complain & tf_warning)
@@ -4827,6 +4835,11 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
if (!VOID_TYPE_P (type))
{
complete_type (type);
+ if (deleting
+ && !verify_type_context (input_location, TCTX_DEALLOCATION, type,
+ !(complain & tf_error)))
+ return error_mark_node;
+
if (!COMPLETE_TYPE_P (type))
{
if (complain & tf_warning)