#include<iostream> using namespace std; class A { public: template<typename T> T f(void){T result = 0; return result;} }; template<typename T> class B { public: T g(void){A a;return a.f<T>();} // this line is changed }; int main(void) { B<int>b; cout<<b.g()<<endl; return 0; } //Error: //a.C: In member function `T B<T>::g()': //a.C:17: error: parse error before `;' token
This is a dup of one of the most reported bugs, PR 795. This is fixed in 3.4.0 already (which is going to be released in the next few weeks). *** This bug has been marked as a duplicate of 795 ***