https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61642
Bug ID: 61642 Summary: g++ confuses template member template function with template class Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: felix at fontein dot de The following code does not compile under GCC 4.9.0 20140604 (prerelease): ---------8<---------8<---------8<--------- template<typename T> struct X { }; template<typename Ftype, int x, int y> void fCall(Ftype & f) { f.template X<x, y>(); // compiler stops here, confuses f's // member template X with the template // class X defined above } // To be used like this: struct F { template<int x, int y> void X() { } }; int main() { F f; fCall<F, 1, 2>(f); } ---------8<---------8<---------8<--------- The error message: $ g++ -Wall -Wextra t2.cpp -o t2 t2.cpp: In function ‘void fCall(Ftype&)’: t2.cpp:6:22: error: wrong number of template arguments (2, should be 1) f.template X<x, y>(); ^ t2.cpp:1:29: error: provided for ‘template<class T> struct X’ template<typename T> struct X { }; $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/gcc/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-isl-version-check --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 4.9.0 20140604 (prerelease) (GCC)