I was wondering why this doesn't compile. This is a simplified example of something that would be very useful to me in some template work I'm doing. I wouldn't think this template would be generated at all as I never use it, and so should not generate errors. Perhaps typedef's work in a different fashion than I expect.Code:template<typename Type> class GetTypeRegister { public: typedef Type::InnerClass type;//Errors on this line }; int main() { }
It generates the following errors and warnings (file paths cut for brevity).
Code:warning C4346: 'Type::InnerClass' : dependent name is not a type prefix with 'typename' to indicate a type see reference to class template instantiation 'GetTypeRegister<Type>' being compiled error C2146: syntax error : missing ';' before identifier 'type' warning C4517: access-declarations are deprecated; member using-declarations provide a better alternative error C4430: missing type specifier - int assumed. Note: C++ does not support default-int