The information in this article applies to:
SYMPTOMSWhen a class is derived from multiple classes such that two or more of the base classes are nested classes of the same name, pointers to either of the nested base classes point to the same address. Consider a class D which is derived from both B1::Nested and B2::Nested. Given an object d, which is of type D, then (B1::Nested *)&d and (B2::Nested *)&d will both resolve to the same address. If either of the nested base class' names are changed to be unique, the behavior is normal. RESOLUTIONThis happens only when the nested classes have the same name. Change the names, for example "A::NestedA" and "B::NestedB". STATUSThis bug was corrected in Microsoft Visual C++, version 6.0. MORE INFORMATIONSample Code to Reproduce Error
In this example, the compiler confuses (A::Nested*) and (B::Nested*), so
the same values are printed for both ((A::Nested*)&m) and ((B::Nested*)&m)
when they should be different. This also causes the call to B_Func on the
last line to call A_Func instead.
Additional query words:
Keywords : kbnokeyword kbVC200bug kbVC210bug kbVC220bug kbVC400bug kbVC410bug kbVC420bug kbVC500bug kbVC600fix |
Last Reviewed: April 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |