Microsoft KB Archive/214619

= FIX: Type Definition Is Not Inherited in Derived Template Class =

Article ID: 214619

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q214619



SYMPTOMS
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: ' ' : is not a class or namespace name



RESOLUTION
To work around this problem, reimplement the typedef down the hierarchy of derived classes.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.



MORE INFORMATION
The following sample code reproduces the behavior:

Compile options needed: None.

template  struct A { typedef int MyIntA; };

template  struct B { typedef A ATempl; };

template  struct C : public B {   // Uncomment the following line for the workaround. // typedef A ATempl; };

template  struct D: public C< A > {   typedef typename ATempl::MyIntA MyIntD; // Does not inherit from // class B. };

Keywords: kberrmsg kbbug kbfix kblangcpp kbcpponly kbcompiler KB214619

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.