aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-02 18:00:16 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-02 18:00:16 -0400
commit9c69dcea0d67714ca0ce52317725ccf1644ce93e (patch)
treef338955c0b3529289670686e025251dc71b8089e
parentb73a47045560ac7b2b808736383e8b5f8a97f55a (diff)
downloadgcc-9c69dcea0d67714ca0ce52317725ccf1644ce93e.zip
gcc-9c69dcea0d67714ca0ce52317725ccf1644ce93e.tar.gz
gcc-9c69dcea0d67714ca0ce52317725ccf1644ce93e.tar.bz2
tree.c (build_vec_init_expr): Take complain parm.
* tree.c (build_vec_init_expr): Take complain parm. (build_vec_init_elt): Likewise. Free arg vector. (diagnose_non_constexpr_vec_init, build_array_copy): Adjust. * cp-tree.h (VEC_INIT_EXPR_SLOT): Use VEC_INIT_EXPR_CHECK. (VEC_INIT_EXPR_INIT): Likewise. Adjust build_vec_init_expr declaration. * init.c (perform_member_init): Adjust. From-SVN: r173275
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/cp-tree.h6
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/tree.c19
4 files changed, 24 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f36182f..6cf0722 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,13 @@
2011-05-02 Jason Merrill <jason@redhat.com>
+ * tree.c (build_vec_init_expr): Take complain parm.
+ (build_vec_init_elt): Likewise. Free arg vector.
+ (diagnose_non_constexpr_vec_init, build_array_copy): Adjust.
+ * cp-tree.h (VEC_INIT_EXPR_SLOT): Use VEC_INIT_EXPR_CHECK.
+ (VEC_INIT_EXPR_INIT): Likewise.
+ Adjust build_vec_init_expr declaration.
+ * init.c (perform_member_init): Adjust.
+
Revert:
PR c++/40975
* cp-tree.def (VEC_INIT_EXPR): Add third operand.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 9bad404..961581e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2896,8 +2896,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
(arg) = next_aggr_init_expr_arg (&(iter)))
/* VEC_INIT_EXPR accessors. */
-#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (NODE, 0)
-#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (NODE, 1)
+#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0)
+#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1)
/* Indicates that a VEC_INIT_EXPR is a potential constant expression.
Only set when the current function is constexpr. */
@@ -5420,7 +5420,7 @@ extern tree get_target_expr_sfinae (tree, tsubst_flags_t);
extern tree build_cplus_array_type (tree, tree);
extern tree build_array_of_n_type (tree, int);
extern tree build_array_copy (tree);
-extern tree build_vec_init_expr (tree, tree);
+extern tree build_vec_init_expr (tree, tree, tsubst_flags_t);
extern void diagnose_non_constexpr_vec_init (tree);
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 50dbcc9..7a7379e 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -506,7 +506,7 @@ perform_member_init (tree member, tree init)
/* mem() means value-initialization. */
if (TREE_CODE (type) == ARRAY_TYPE)
{
- init = build_vec_init_expr (type, init);
+ init = build_vec_init_expr (type, init, tf_warning_or_error);
init = build2 (INIT_EXPR, type, decl, init);
finish_expr_stmt (init);
}
@@ -543,7 +543,7 @@ perform_member_init (tree member, tree init)
|| same_type_ignoring_top_level_qualifiers_p (type,
TREE_TYPE (init)))
{
- init = build_vec_init_expr (type, init);
+ init = build_vec_init_expr (type, init, tf_warning_or_error);
init = build2 (INIT_EXPR, type, decl, init);
finish_expr_stmt (init);
}
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index dfd11ad..0f2f86c 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -475,7 +475,7 @@ build_cplus_new (tree type, tree init, tsubst_flags_t complain)
another array to copy. */
static tree
-build_vec_init_elt (tree type, tree init)
+build_vec_init_elt (tree type, tree init, tsubst_flags_t complain)
{
tree inner_type = strip_array_types (type);
VEC(tree,gc) *argvec;
@@ -485,7 +485,7 @@ build_vec_init_elt (tree type, tree init)
/* No interesting initialization to do. */
return integer_zero_node;
else if (init == void_type_node)
- return build_value_init (inner_type, tf_warning_or_error);
+ return build_value_init (inner_type, complain);
gcc_assert (init == NULL_TREE
|| (same_type_ignoring_top_level_qualifiers_p
@@ -499,9 +499,12 @@ build_vec_init_elt (tree type, tree init)
dummy = move (dummy);
VEC_quick_push (tree, argvec, dummy);
}
- return build_special_member_call (NULL_TREE, complete_ctor_identifier,
+ init = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&argvec, inner_type, LOOKUP_NORMAL,
- tf_warning_or_error);
+ complain);
+ release_tree_vector (argvec);
+
+ return init;
}
/* Return a TARGET_EXPR which expresses the initialization of an array to
@@ -509,11 +512,11 @@ build_vec_init_elt (tree type, tree init)
from another array of the same type. */
tree
-build_vec_init_expr (tree type, tree init)
+build_vec_init_expr (tree type, tree init, tsubst_flags_t complain)
{
tree slot;
bool value_init = false;
- tree elt_init = build_vec_init_elt (type, init);
+ tree elt_init = build_vec_init_elt (type, init, complain);
if (init == void_type_node)
{
@@ -550,14 +553,14 @@ diagnose_non_constexpr_vec_init (tree expr)
else
init = VEC_INIT_EXPR_INIT (expr);
- elt_init = build_vec_init_elt (type, init);
+ elt_init = build_vec_init_elt (type, init, tf_warning_or_error);
require_potential_constant_expression (elt_init);
}
tree
build_array_copy (tree init)
{
- return build_vec_init_expr (TREE_TYPE (init), init);
+ return build_vec_init_expr (TREE_TYPE (init), init, tf_warning_or_error);
}
/* Build a TARGET_EXPR using INIT to initialize a new temporary of the