BUG: Type Definition Is Not Inherited in Derived Template ClassID: Q214619
|
When you compile a template class that references a type that is defined in a base template class, the following error message might appear:
error C2653: '<type-name>' : is not a class or namespace name
To work around this problem, reimplement the typedef down the hierarchy of derived classes.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
The following sample code reproduces the behavior:
Compile options needed: None.
template <class T>
struct A
{
typedef int MyIntA;
};
template <class T>
struct B
{
typedef A<T> ATempl;
};
template <class T>
struct C : public B<T>
{
// Uncomment the following line for the workaround.
// typedef A<T> ATempl;
};
template <class T>
struct D: public C< A<T> >
{
typedef typename ATempl::MyIntA MyIntD; // Does not inherit from
// class B.
};
Additional query words:
Keywords : kberrmsg kbCompiler kbCPPonly kbLangCPP kbVC600bug
Version : winnt:6.0
Platform : winnt
Issue type : kbbug
Last Reviewed: February 26, 1999