aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-10-06 12:38:05 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-10-06 12:38:05 +0000
commit683b80daf3c474cda528f06e8c3557120b6e924c (patch)
tree731bf202819f0c48bf27fbce98d594d4ecb71e4a
parent37053d1fe5f2eac2a8c267d318cbc9d7ee8aff7a (diff)
downloadgcc-683b80daf3c474cda528f06e8c3557120b6e924c.zip
gcc-683b80daf3c474cda528f06e8c3557120b6e924c.tar.gz
gcc-683b80daf3c474cda528f06e8c3557120b6e924c.tar.bz2
call.c (resolve_args): Resolve template specializations, if possible.
* call.c (resolve_args): Resolve template specializations, if possible. From-SVN: r22867
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c20
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/overload4.C8
3 files changed, 28 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fa705cc..ff3901d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1998-10-06 Mark Mitchell <mark@markmitchell.com>
+
+ * call.c (resolve_args): Resolve template specializations, if
+ possible.
+
Tue Oct 6 07:57:26 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (spew.o): Depend on toplev.h.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f431885..f01aacb 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2255,6 +2255,26 @@ resolve_args (args)
}
else if (TREE_CODE (TREE_VALUE (t)) == OFFSET_REF)
TREE_VALUE (t) = resolve_offset_ref (TREE_VALUE (t));
+ else if (TREE_CODE (TREE_VALUE (t)) == TEMPLATE_ID_EXPR)
+ {
+ tree targs;
+ tree r;
+
+ r = determine_specialization (TREE_VALUE (t), NULL_TREE,
+ &targs,
+ /*need_member_template=*/0,
+ /*complain=*/0);
+
+ /* If we figured out what was being specialized, use it.
+ Otherwise, the function being called may resolve the
+ choice of specialization, so we don't issue any error
+ messages here. */
+ if (r)
+ {
+ r = instantiate_template (r, targs);
+ TREE_VALUE (t) = r;
+ }
+ }
}
return args;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload4.C b/gcc/testsuite/g++.old-deja/g++.pt/overload4.C
index a62f61b..f4e58e2 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/overload4.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/overload4.C
@@ -1,14 +1,12 @@
// Build don't link:
-// crash test - XFAIL *-*-*
-
template <class T> void foo(T);
template <class T> void bar(void (*)(T), T);
void baz() {
bar<int>(foo, 1);
- bar(foo<int>, 1); // explicit args for foo don't help
- bar<int>(foo<int>, 1); // not even here
- bar(foo, 1);
+ bar(foo<int>, 1);
+ bar<int>(foo<int>, 1);
+ bar(foo, 1);
}