pt.c (fn_type_unification): Allow incomplete unification without an immediate error message.

* pt.c (fn_type_unification): Allow incomplete unification without
	an immediate error message.

From-SVN: r18912
This commit is contained in:
Mark Mitchell 1998-03-30 12:17:01 +00:00 committed by Mark Mitchell
parent b04cd50711
commit 7cd55873dc
3 changed files with 37 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Mon Mar 30 12:15:00 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (fn_type_unification): Allow incomplete unification without
an immediate error message.
Mon Mar 30 08:55:42 1998 Jason Merrill <jason@yorick.cygnus.com>
* tree.c (member_p): New fn.

View File

@ -5325,12 +5325,16 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
fn_arg_types = scratch_tree_cons (NULL_TREE, extra_fn_arg,
fn_arg_types);
/* We allow incomplete unification without an error message here
because the standard doesn't seem to explicitly prohibit it. Our
callers must be ready to deal with unification failures in any
event. */
i = type_unification (DECL_INNERMOST_TEMPLATE_PARMS (fn),
targs,
fn_arg_types,
decl_arg_types,
explicit_targs,
strict, 0);
strict, 1);
return i;
}

View File

@ -0,0 +1,27 @@
// Build don't link:
template <class T>
struct S
{
typedef T S_Type;
};
template <class T>
void foo(typename S<T>::S_Type)
{
}
template <class T>
void foo(T)
{
}
struct S2 {};
void bar()
{
foo(S2()); // We can't unify with the first foo, so we get the second.
}