This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for g++.pt/overload4.C
- To: Jason Merrill <jason at cygnus dot com>
- Subject: PATCH for g++.pt/overload4.C
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Tue, 6 Oct 1998 12:38:34 -0700
- Cc: egcs-patches at cygnus dot com
- Reply-to: mark at markmitchell dot com
Here's a patch for this test-case above.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com
1998-10-06 Mark Mitchell <mark@markmitchell.com>
* call.c (resolve_args): Resolve template specializations, if
possible.
Index: cp/call.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/call.c,v
retrieving revision 1.111
diff -c -p -r1.111 call.c
*** call.c 1998/10/06 05:04:28 1.111
--- call.c 1998/10/06 19:32:33
*************** resolve_args (args)
*** 2255,2260 ****
--- 2255,2280 ----
}
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: testsuite/g++.old-deja/g++.pt/overload4.C
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/g++.old-deja/g++.pt/overload4.C,v
retrieving revision 1.2
diff -c -p -r1.2 overload4.C
*** overload4.C 1998/10/04 15:44:36 1.2
--- overload4.C 1998/10/06 19:32:33
***************
*** 1,14 ****
// 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);
}
--- 1,12 ----
// Build don't link:
template <class T> void foo(T);
template <class T> void bar(void (*)(T), T);
void baz() {
bar<int>(foo, 1);
! bar(foo<int>, 1);
! bar<int>(foo<int>, 1);
! bar(foo, 1);
}