From 7cd55873dc8fdbfaa42e58d18246e007b8fb3e0e Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 30 Mar 1998 12:17:01 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 6 +++++- gcc/testsuite/g++.old-deja/g++.pt/unify2.C | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/unify2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f7d586f..7fdc60b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +Mon Mar 30 12:15:00 1998 Mark Mitchell + + * pt.c (fn_type_unification): Allow incomplete unification without + an immediate error message. + Mon Mar 30 08:55:42 1998 Jason Merrill * tree.c (member_p): New fn. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4f87928..779d06c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify2.C b/gcc/testsuite/g++.old-deja/g++.pt/unify2.C new file mode 100644 index 0000000..89b043d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/unify2.C @@ -0,0 +1,27 @@ +// Build don't link: + +template +struct S +{ + typedef T S_Type; +}; + + +template +void foo(typename S::S_Type) +{ +} + + +template +void foo(T) +{ +} + + +struct S2 {}; + +void bar() +{ + foo(S2()); // We can't unify with the first foo, so we get the second. +} -- 2.7.4