g++ is unable to compile a call to a templatized method from a template function that takes the class that contains the templatized methods as a template parameter.
Environment: System: Linux bnell-deb4-64 2.6.18-4-amd64 #1 SMP Mon Mar 26 11:36:53 CEST 2007 x86_64 GNU/Linux Architecture: x86_64 host: x86_64-unknown-linux-gnu build: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu configured with: ../../../sources/gcc/configure --prefix=/hub/Linux/glibc-2.3.6/x86_64/apps/gcc-4.1.1 --with-gmp=/mathworks/devel/sandbox/greg/Amake/3p/derived/glnxa64/gcc/gmp --with-mpfr=/mathworks/devel/sandbox/greg/Amake/3p/derived/glnxa64/gcc/mpfr --enable-languages=c,c++,fortran --with-as=/hub/Linux/glibc-2.3.6/x86_64/apps/gcc-4.1.1/bin/as --with-ld=/hub/Linux/glibc-2.3.6/x86_64/apps/gcc-4.1.1/bin/ld --disable-multilib How-To-Repeat: 1) save the following code into bug.cpp struct foo { template <int n> const void* bar(char* p) const { return p; } template <typename T> const void* moo(char* p) const { return p; } }; template <typename F> void test_template(const F& f) { f.bar<3>(0); // doesn't work here f.moo<int>(0); // doesn't work here } int main(int argc, char* argv[]) { foo f; f.bar<3>(0); // works here f.moo<int>(0); // works here test_template(f); return 0; } 2) attempt to compile: g++ -o bug bug.cpp -- Summary: g++ fails to compile legal template code involving templatized methods Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bnell at mathworks dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35021