From 86e6f22fcc0ba44042c9546b875eafb9f9649125 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 30 Jul 1997 23:01:56 +0000 Subject: [PATCH] 92th Cygnus<->FSF quick merge From-SVN: r14566 --- gcc/cp/ChangeLog | 11 ++++++++++ gcc/cp/call.c | 52 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 164551b48a8..303c72a1c69 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +Tue Jul 29 21:17:29 1997 Jason Merrill + + * call.c (resolve_args): New fn. + (build_new_function_call): Use it. + (build_object_call): Likewise. + (build_new_method_call): Likewise. + +Mon Jul 28 16:02:36 1997 Jason Merrill + + * call.c (build_over_call): tsubst all default parms from templates. + Wed Jul 23 13:36:25 1997 Jason Merrill * decl.c (struct cp_function): Add static_labelno. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 14f84084314..48c7bb96339 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4338,6 +4338,28 @@ build_user_type_conversion (totype, expr, flags) return NULL_TREE; } +/* Do any initial processing on the arguments to a function call. */ + +static tree +resolve_args (args) + tree args; +{ + tree t; + for (t = args; t; t = TREE_CHAIN (t)) + { + if (TREE_VALUE (t) == error_mark_node) + return error_mark_node; + else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE) + { + error ("invalid use of void expression"); + return error_mark_node; + } + else if (TREE_CODE (TREE_VALUE (t)) == OFFSET_REF) + TREE_VALUE (t) = resolve_offset_ref (TREE_VALUE (t)); + } + return args; +} + tree build_new_function_call (fn, args, obj) tree fn, args, obj; @@ -4349,17 +4371,11 @@ build_new_function_call (fn, args, obj) tree t; tree templates = NULL_TREE; - for (t = args; t; t = TREE_CHAIN (t)) - { - if (TREE_VALUE (t) == error_mark_node) - return error_mark_node; - else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE) - { - error ("invalid use of void expression"); - return error_mark_node; - } - } - + args = resolve_args (args); + + if (args == error_mark_node) + return error_mark_node; + for (t = TREE_VALUE (fn); t; t = DECL_CHAIN (t)) { if (TREE_CODE (t) == TEMPLATE_DECL) @@ -4416,6 +4432,11 @@ build_object_call (obj, args) fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 0); + args = resolve_args (args); + + if (args == error_mark_node) + return error_mark_node; + if (fns) { tree fn = TREE_VALUE (fns); @@ -5113,7 +5134,7 @@ build_over_call (fn, convs, args, flags) { tree arg = TREE_PURPOSE (parm); - if (DECL_TEMPLATE_INFO (fn) && uses_template_parms (arg)) + if (DECL_TEMPLATE_INFO (fn)) /* This came from a template. Instantiate the default arg here, not in tsubst. */ arg = tsubst_expr (arg, @@ -5266,9 +5287,10 @@ build_new_method_call (instance, name, args, basetype_path, flags) if (flags & LOOKUP_HAS_IN_CHARGE) user_args = TREE_CHAIN (args); - for (fns = args; fns; fns = TREE_CHAIN (fns)) - if (TREE_VALUE (fns) == error_mark_node) - return error_mark_node; + args = resolve_args (args); + + if (args == error_mark_node) + return error_mark_node; if (instance == NULL_TREE) basetype = BINFO_TYPE (basetype_path); -- 2.30.2