aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-03-19 11:52:21 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-03-19 06:52:21 -0500
commit76b9a14d4d618456558ba4125027be74d1fe29e2 (patch)
tree6ef4aecd0c27bda79f02c2bd390659cb8ee5edf8
parent838b0e4efa12921ecfd261250c2e08851e25883a (diff)
downloadgcc-76b9a14d4d618456558ba4125027be74d1fe29e2.zip
gcc-76b9a14d4d618456558ba4125027be74d1fe29e2.tar.gz
gcc-76b9a14d4d618456558ba4125027be74d1fe29e2.tar.bz2
pt.c (get_bindings_real): Rename from get_bindings.
* pt.c (get_bindings_real): Rename from get_bindings. Add check_rettype parm. (get_bindings): Pass 1. (get_bindings_overload): Pass 0. From-SVN: r18708
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c40
2 files changed, 38 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2fe1fa9..a586432 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+Thu Mar 19 11:51:58 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (get_bindings_real): Rename from get_bindings. Add
+ check_rettype parm.
+ (get_bindings): Pass 1.
+ (get_bindings_overload): Pass 0.
+
Wed Mar 19 09:08:12 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (check_explicit_specialization): When reverting a static
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1bd8dbb..be3e5ac 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -86,6 +86,7 @@ static int type_unification_real PROTO((tree, tree *, tree, tree,
static void note_template_header PROTO((int));
static tree maybe_fold_nontype_arg PROTO((tree));
static tree convert_nontype_argument PROTO((tree, tree));
+static tree get_bindings_overload PROTO((tree, tree, tree));
/* Do any processing required when DECL (a member template declaration
using TEMPLATE_PARAMETERS as its innermost parameter list) is
@@ -5608,13 +5609,13 @@ more_specialized (pat1, pat2, explicit_args)
tree targs;
int winner = 0;
- targs = get_bindings (pat1, pat2, explicit_args);
+ targs = get_bindings_overload (pat1, pat2, explicit_args);
if (targs)
{
--winner;
}
- targs = get_bindings (pat2, pat1, explicit_args);
+ targs = get_bindings_overload (pat2, pat1, explicit_args);
if (targs)
{
++winner;
@@ -5653,11 +5654,13 @@ more_specialized_class (pat1, pat2)
/* Return the template arguments that will produce the function signature
DECL from the function template FN, with the explicit template
- arguments EXPLICIT_ARGS. */
+ arguments EXPLICIT_ARGS. If CHECK_RETTYPE is 1, the return type must
+ also match. */
-tree
-get_bindings (fn, decl, explicit_args)
+static tree
+get_bindings_real (fn, decl, explicit_args, check_rettype)
tree fn, decl, explicit_args;
+ int check_rettype;
{
int ntparms = DECL_NTPARMS (fn);
tree targs = make_scratch_vec (ntparms);
@@ -5691,18 +5694,37 @@ get_bindings (fn, decl, explicit_args)
1,
extra_fn_arg);
- if (i == 0)
+ 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, NULL_TREE);
if (!comptypes (t, TREE_TYPE (TREE_TYPE (decl)), 1))
return NULL_TREE;
-
- return targs;
}
- return NULL_TREE;
+ return targs;
+}
+
+/* For most uses, we want to check the return type. */
+
+tree
+get_bindings (fn, decl, explicit_args)
+ tree fn, decl, explicit_args;
+{
+ return get_bindings_real (fn, decl, explicit_args, 1);
+}
+
+/* But for more_specialized, we only care about the parameter types. */
+
+static tree
+get_bindings_overload (fn, decl, explicit_args)
+ tree fn, decl, explicit_args;
+{
+ return get_bindings_real (fn, decl, explicit_args, 0);
}
static tree