call.c (resolve_args): Resolve template specializations, if possible.
authorMark Mitchell <mark@markmitchell.com>
Tue, 6 Oct 1998 12:38:05 +0000 (12:38 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 6 Oct 1998 12:38:05 +0000 (12:38 +0000)
* call.c (resolve_args): Resolve template specializations, if
possible.

From-SVN: r22867

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.old-deja/g++.pt/overload4.C

index fa705cc7ec1e54655f7d1b45c4bb4065e83a7c28..ff3901d385519439a3b2583c0c88e5207563c5b4 100644 (file)
@@ -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.
index f431885ab37348a2d936691a59a5a547a537a890..f01aacb09c03b851a2571bab43f45a6b51f6c3c9 100644 (file)
@@ -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;
 }
index a62f61b0e0babeb387287e1f1f144130e2351807..f4e58e27fc7e20140bddb517a27e780ca7709c96 100644 (file)
@@ -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); 
 }