FIX: Wrong Pointer Value When Nested Classes Have Same Name (143082)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q143082 SYMPTOMS
When 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.
RESOLUTION
This 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.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbfix kbVC600fix KB143082 |
---|
|