From 68361a039607fe2fbcd28cb4dae237f13f834f76 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 20 Jun 2003 15:44:25 +0000 Subject: [PATCH] re PR c++/10845 (template member function (getting a nested template as parameter) cannot be called anymore if another unrelated template member function is defined.) PR c++/10845 * pt.c (try_class_unification): Correct handling of member class templates. * semantics.c (genrtl_finish_function): Adjust expand_function_end call. From-SVN: r68269 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/member3.C | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/member3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f92411253b6..8ed6d9c2260 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-06-20 Mark Mitchell + + PR c++/10845 + * pt.c (try_class_unification): Correct handling of member class + templates. + 2003-06-20 Nathan Sidwell * semantics.c (genrtl_finish_function): Adjust diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1a43d020c59..7ce9031e033 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9078,7 +9078,8 @@ try_class_unification (tree tparms, tree targs, tree parm, tree arg) tree copy_of_targs; if (!CLASSTYPE_TEMPLATE_INFO (arg) - || CLASSTYPE_TI_TEMPLATE (arg) != CLASSTYPE_TI_TEMPLATE (parm)) + || (most_general_template (CLASSTYPE_TI_TEMPLATE (arg)) + != most_general_template (CLASSTYPE_TI_TEMPLATE (parm)))) return NULL_TREE; /* We need to make a new template argument vector for the call to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e4cafa9446..ff02c29a9c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-06-20 Mark Mitchell + + PR c++/10845 + * g++.dg/template/member3.C: New test. + 2003-06-19 Mark Mitchell PR c++/10939 diff --git a/gcc/testsuite/g++.dg/template/member3.C b/gcc/testsuite/g++.dg/template/member3.C new file mode 100644 index 00000000000..4f87e57bcb3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/member3.C @@ -0,0 +1,19 @@ +template +struct A { + template struct SubA { }; + + template void f(T1 & t1, SubA & t2) { } + template void g(SubA & suba) { } + template void h(SubA & suba) { } +}; + +int main(void) { + int i; + A a; + A::SubA suba; + + a.f(i,suba); + a.g(suba); + a.h(suba); +} +