aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-02-29 10:29:52 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-02-29 10:29:52 +0000
commit8d3631f8a345db1d5d5301a62618004b339a4dec (patch)
tree080dc4fc58c5703a899602cb38bd655fd4a062a7
parent898d4b17a695bb46d7622a24a002b54f3826d8b9 (diff)
downloadgcc-8d3631f8a345db1d5d5301a62618004b339a4dec.zip
gcc-8d3631f8a345db1d5d5301a62618004b339a4dec.tar.gz
gcc-8d3631f8a345db1d5d5301a62618004b339a4dec.tar.bz2
pt.c (fn_type_unification): Unify return type, whenever provided.
* pt.c (fn_type_unification): Unify return type, whenever provided. (get_bindings_real): Only pass return type when necessary. Remove explicit return type check. * class.c (resolve_address_of_overloaded_function): Pass desired return type to fn_type_unification. From-SVN: r32253
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/pt.c29
3 files changed, 25 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index afe076b..cfbc6f5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2000-02-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (fn_type_unification): Unify return type, whenever
+ provided.
+ (get_bindings_real): Only pass return type when necessary.
+ Remove explicit return type check.
+ * class.c (resolve_address_of_overloaded_function): Pass desired
+ return type to fn_type_unification.
+
Mon Feb 28 08:15:23 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 6f41290..3f922ef 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5829,6 +5829,7 @@ resolve_address_of_overloaded_function (target_type,
{
tree target_fn_type;
tree target_arg_types;
+ tree target_ret_type;
tree fns;
if (is_ptrmem)
@@ -5837,6 +5838,7 @@ resolve_address_of_overloaded_function (target_type,
else
target_fn_type = TREE_TYPE (target_type);
target_arg_types = TYPE_ARG_TYPES (target_fn_type);
+ target_ret_type = TREE_TYPE (target_fn_type);
for (fns = overload; fns; fns = OVL_CHAIN (fns))
{
@@ -5858,7 +5860,7 @@ resolve_address_of_overloaded_function (target_type,
/* Try to do argument deduction. */
targs = make_tree_vec (DECL_NTPARMS (fn));
if (fn_type_unification (fn, explicit_targs, targs,
- target_arg_types, NULL_TREE,
+ target_arg_types, target_ret_type,
DEDUCE_EXACT) != 0)
/* Argument deduction failed. */
continue;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f909c8c..64b48c4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7562,12 +7562,18 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
if (DECL_CONV_FN_P (fn))
{
- /* This is a template conversion operator. Use the return types
- as well as the argument types. We use it instead of 'this', since
+ /* This is a template conversion operator. Remove `this', since
we could be comparing conversions from different classes. */
- parms = tree_cons (NULL_TREE, TREE_TYPE (fntype),
- TREE_CHAIN (parms));
- args = tree_cons (NULL_TREE, return_type, TREE_CHAIN (args));
+ parms = TREE_CHAIN (parms);
+ args = TREE_CHAIN (args);
+ my_friendly_assert (return_type != NULL_TREE, 20000227);
+ }
+
+ if (return_type)
+ {
+ /* We've been given a return type to match, prepend it. */
+ parms = tree_cons (NULL_TREE, TREE_TYPE (fntype), parms);
+ args = tree_cons (NULL_TREE, return_type, args);
}
/* We allow incomplete unification without an error message here
@@ -8793,22 +8799,13 @@ get_bindings_real (fn, decl, explicit_args, check_rettype)
i = fn_type_unification (fn, explicit_args, targs,
decl_arg_types,
- TREE_TYPE (decl_type),
+ (check_rettype || DECL_CONV_FN_P (fn)
+ ? TREE_TYPE (decl_type) : NULL_TREE),
DEDUCE_EXACT);
if (i != 0)
return NULL_TREE;
- if (check_rettype)
- {
- /* Check to see that the resulting return type is also OK. */
- tree t = tsubst (TREE_TYPE (TREE_TYPE (fn)), targs,
- /*complain=*/0, NULL_TREE);
-
- if (!same_type_p (t, TREE_TYPE (TREE_TYPE (decl))))
- return NULL_TREE;
- }
-
return targs;
}