error: no matching function for call to `A<int>::f(int&, A<int>::SubA<int>&)'. In what follows, words written as _underscored_ mean that without any _underscored_ hypothesis, bug does not occur. Let us consider a method f (with _two_ templates arguments) of a _template_ class A. The first argument is given by a _template T1_. The second argument is given as a _template_ sub class of A (SubA<L>) and the second template typename of f is given for matching L. Moreover, there exists (at least) another template method in A which has the same argument type than the second one of f. Then f cannot be found when it is called. Release: g++-3.2, 3.3 Environment: Linux i686 How-To-Repeat: Try to compile this code ---8<------------ template<typename T> struct A { template<typename L> struct SubA { }; template<typename T1,typename L> void f(T1 & t1, SubA<L> & t2) { } template<typename U> void g(SubA<U> & suba) { } template<typename U> void h(SubA<U> & suba) { } }; int main(void) { int i; A<int> a; A<int>::SubA<int> suba; a.f(i,suba); a.g(suba); a.h(suba); }
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. The funny thing about this bug is that if you remove the member functions g() and h(), the call to f() succeeds. I rate this as a regression because the above snippet without h() compiles with 2.95 but fails on 3.x. The snippet provided by the poster fails also with 2.95, but it's the opposite problem: it manages to call f() but not g() and h().
Subject: Bug 10845 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-06-20 15:44:25 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: member3.C Log message: PR c++/10845 * pt.c (try_class_unification): Correct handling of member class templates. * semantics.c (genrtl_finish_function): Adjust expand_function_end call. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3443&r2=1.3444 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.703&r2=1.704 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2784&r2=1.2785 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/member3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 10845 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-06-20 15:46:42 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: member3.C Log message: PR c++/10845 * pt.c (try_class_unification): Correct handling of member class templates. PR c++/10845 * g++.dg/template/member3.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.156&r2=1.3076.2.157 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.635.2.29&r2=1.635.2.30 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.194&r2=1.2261.2.195 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/member3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Fixed in GCC 3.3.1, GCC 3.4.