mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 03:30:27 +08:00
call.c (resolve_args): Resolve template specializations, if possible.
* call.c (resolve_args): Resolve template specializations, if possible. From-SVN: r22867
This commit is contained in:
parent
37053d1fe5
commit
683b80daf3
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user