From 683b80daf3c474cda528f06e8c3557120b6e924c Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 6 Oct 1998 12:38:05 +0000 Subject: [PATCH] call.c (resolve_args): Resolve template specializations, if possible. * call.c (resolve_args): Resolve template specializations, if possible. From-SVN: r22867 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 20 +++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/overload4.C | 8 +++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fa705cc7ec1e..ff3901d38551 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1998-10-06 Mark Mitchell + + * call.c (resolve_args): Resolve template specializations, if + possible. + Tue Oct 6 07:57:26 1998 Kaveh R. Ghazi * Makefile.in (spew.o): Depend on toplev.h. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f431885ab373..f01aacb09c03 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 a62f61b0e0ba..f4e58e27fc7e 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 void foo(T); template void bar(void (*)(T), T); void baz() { bar(foo, 1); - bar(foo, 1); // explicit args for foo don't help - bar(foo, 1); // not even here - bar(foo, 1); + bar(foo, 1); + bar(foo, 1); + bar(foo, 1); }