Original Code:
template<class T>const T::X& f(T::Z* p);
template<class T, int N>struct Baz{};
template<class T>struct Blah : public Baz< T::Type, T::Value> { typedef T::X Type; Type foo(); T::X bar(); operator T::Z(); };
Errors VC2005 issue:
sample.cpp(2) : warning C4346: 'T::X' : dependent name is not a type prefix with 'typename' to indicate a typesample.cpp(2) : error C2143: syntax error : missing ';' before '&'sample.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intsample.cpp(2) : fatal error C1903: unable to recover from previous erro(s); stopping compilation
Code after applying the fix:
template<class T>const typename T::X& f(typename T::Z* p);
template<class T>struct Blah : public Baz<typename T::Type, T::Value> { typedef typename T::X Type; Type foo(); typename T::X bar(); operator typename T::Z(); };
Thanks,Ayman shoukry