aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-06-16 07:34:51 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-06-16 07:34:51 +0000
commitfd74ca0bf2e6effbc70d576114f7fca2ff341f47 (patch)
tree396b0aea2fa14d244a3fde9486d0ea106b5b7006 /gcc/cp/pt.c
parentff1c0096a1cb412bed7d62e333dcd4020c90ca7c (diff)
downloadgcc-fd74ca0bf2e6effbc70d576114f7fca2ff341f47.zip
gcc-fd74ca0bf2e6effbc70d576114f7fca2ff341f47.tar.gz
gcc-fd74ca0bf2e6effbc70d576114f7fca2ff341f47.tar.bz2
cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list.
* cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. (current_base_init_list): Remove. (current_member_init_list): Likewise. (setup_vtbl_ptr): Change prototype. (emit_base_init): Likewise. (expand_member_init): Likewise. (reinit_parse_for_function): Remove. * decl.c (save_function_data): Don't clear x_base_init_list and x_member_init_list. (mark_language_function): Don't mark them. * init.c (perform_member_init): Tweak comment. (sort_member_init): Take the list of initializers as an argument. (sort_base_init): Likewise. (emit_base_init): Likewise. (expand_member_init): Return the initializer. Don't use global variables. * lex.c (reinit_parse_for_function): Remove. * method.c (build_template_parm_names): Correct substitution. (do_build_copy_constructor): Don't use current_member_init_list and current_base_init_list. (synthesize_method): Likewise. * parse.y (base_init): Split mem-initializers into base-initializers and field-initializers. (member_init_list): Build up the list here. (member_init): Return the initializer. (fn.depfn): Don't use reinit_parse_for_function. * parse.c: Regenerated. * pt.c (convert_nontype_argument): Don't make an ADDR_EXPR of the ERROR_MARK. (tsubst_expr): Don't use current_member_init_list and current_base_init_list. (tsubst_expr_values): Rename to ... (tsubst_initializer_list): ... this. Use convert_from_reference. * semantics.c (setup_vtbl_ptr): Don't use current_member_init_list and current_base_init_list. (begin_function_definition): Don't call reinit_parse_for_function. * dump.c (dequeue_and_dump): Use TREE_VEC_LENGTH with vectors. * error.c (dump_expr): Handle ADDR_EXPRs with REFERENCE_TYPE correctly. From-SVN: r34571
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 6286d8f..902ebc5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -104,7 +104,7 @@ static int push_tinst_level PARAMS ((tree));
static void reopen_tinst_level PARAMS ((tree));
static tree classtype_mangled_name PARAMS ((tree));
static char *mangle_class_name_for_template PARAMS ((char *, tree, tree));
-static tree tsubst_expr_values PARAMS ((tree, tree));
+static tree tsubst_initializer_list PARAMS ((tree, tree));
static int list_eq PARAMS ((tree, tree));
static tree get_class_bindings PARAMS ((tree, tree, tree));
static tree coerce_template_parms PARAMS ((tree, tree, tree, int, int));
@@ -3009,7 +3009,7 @@ convert_nontype_argument (type, expr)
|| !at_least_as_qualified_p (type_referred_to,
expr_type)
|| !real_lvalue_p (expr))
- expr = error_mark_node;
+ return error_mark_node;
}
mark_addressable (expr);
@@ -7145,14 +7145,19 @@ tsubst_expr (t, args, complain, in_decl)
break;
case CTOR_INITIALIZER:
- prep_stmt (t);
- current_member_init_list
- = tsubst_expr_values (TREE_OPERAND (t, 0), args);
- current_base_init_list
- = tsubst_expr_values (TREE_OPERAND (t, 1), args);
- setup_vtbl_ptr ();
- tsubst_expr (TREE_CHAIN (t), args, complain, in_decl);
- break;
+ {
+ tree member_init_list;
+ tree base_init_list;
+
+ prep_stmt (t);
+ member_init_list
+ = tsubst_initializer_list (TREE_OPERAND (t, 0), args);
+ base_init_list
+ = tsubst_initializer_list (TREE_OPERAND (t, 1), args);
+ setup_vtbl_ptr (member_init_list, base_init_list);
+ tsubst_expr (TREE_CHAIN (t), args, complain, in_decl);
+ break;
+ }
case RETURN_STMT:
prep_stmt (t);
@@ -9837,12 +9842,13 @@ instantiate_pending_templates ()
return instantiated_something;
}
-/* Substitute ARGVEC into T, which is a TREE_LIST. In particular, it
- is an initializer list: the TREE_PURPOSEs are DECLs, and the
- TREE_VALUEs are initializer values. Used by instantiate_decl. */
+/* Substitute ARGVEC into T, which is a list of initializers for
+ either base class or a non-static data member. The TREE_PURPOSEs
+ are DECLs, and the TREE_VALUEs are the initializer values. Used by
+ instantiate_decl. */
static tree
-tsubst_expr_values (t, argvec)
+tsubst_initializer_list (t, argvec)
tree t, argvec;
{
tree first = NULL_TREE;
@@ -9850,11 +9856,24 @@ tsubst_expr_values (t, argvec)
for (; t; t = TREE_CHAIN (t))
{
- tree pur = tsubst_copy (TREE_PURPOSE (t), argvec,
- /*complain=*/1, NULL_TREE);
- tree val = tsubst_expr (TREE_VALUE (t), argvec, /*complain=*/1,
- NULL_TREE);
- *p = build_tree_list (pur, val);
+ tree decl;
+ tree init;
+ tree val;
+
+ decl = tsubst_copy (TREE_PURPOSE (t), argvec, /*complain=*/1,
+ NULL_TREE);
+ init = tsubst_expr (TREE_VALUE (t), argvec, /*complain=*/1,
+ NULL_TREE);
+
+ if (!init)
+ ;
+ else if (TREE_CODE (init) == TREE_LIST)
+ for (val = init; val; val = TREE_CHAIN (val))
+ TREE_VALUE (val) = convert_from_reference (TREE_VALUE (val));
+ else
+ init = convert_from_reference (init);
+
+ *p = build_tree_list (decl, init);
p = &TREE_CHAIN (*p);
}
return first;