The following code demonstrates that GCC raises an invalid error on certain template function syntax. It is the same error than on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19552 but on a NON-DEPENDENT name, so the error is not appropriate here. Please also note that this code compiles on MSVC++ EE 2005.
Here is the source code: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv class template_function { public: template <int N> int func() { return N; }; }; class non_template_class { public: template_function tf; void run() { tf.func<36>(); // SUCCESS } }; // The PointLess template parameter makes gcc // fail to see that tf is a non-dependent name template <int PonitLess> class template_class { public: template_function tf; void run() { tf.func<42>(); // FAIL } }; int main() { non_template_class ntc; ntc.run(); template_class<0> tc; tc.run(); return 0; } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here is the output of G++: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34) /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ main.cpp -Wall main.ii GNU CPP version 3.2.3 20030502 (Red Hat Linux 3.2.3-34) (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/3.2.3 /usr/include/c++/3.2.3/i386-redhat-linux /usr/include/c++/3.2.3/backward /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include /usr/include End of search list. /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -Wall -version -o main.s GNU CPP version 3.2.3 20030502 (Red Hat Linux 3.2.3-34) (cpplib) (i386 Linux/ELF) GNU C++ version 3.2.3 20030502 (Red Hat Linux 3.2.3-34) (i386-redhat-linux) compiled by GNU C version 3.2.3 20030502 (Red Hat Linux 3.2.3-34). main.cpp: In member function `void template_class<PonitLess>::run()': main.cpp:34: syntax error before `;' token ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ And here is the main.ii file: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv # 1 "main.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "main.cpp" class template_function { public: template <int N> int func() { return N; }; }; class non_template_class { public: template_function tf; void run() { tf.func<36>(); } }; template <int PonitLess> class template_class { public: template_function tf; void run() { tf.func<42>(); } }; int main() { non_template_class ntc; ntc.run(); template_class<0> tc; tc.run(); return 0; } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Summary: Invalid template error on non-dependent name Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: trundeg at hotmail dot com GCC host triplet: Linux cfr1ll19 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:28:55 EDT 200 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32022