aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-07-30 23:01:56 +0000
committerMike Stump <mrs@cygnus.com>1997-07-30 23:01:56 +0000
commitfd2c2fe72620ab01cf5d97618b66f1c73ffe8123 (patch)
treeffc169e8d421fe807067aaa486d1d80398535c1c
parent3b1163239ce42edc715ee97332e3420d54a89fd8 (diff)
92th Cygnus<->FSF quick merge
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@14566 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/call.c52
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 <jason@yorick.cygnus.com>
+
+ * 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 <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): tsubst all default parms from templates.
+
Wed Jul 23 13:36:25 1997 Jason Merrill <jason@yorick.cygnus.com>
* 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);