BUG: this Pointer Expands Incorrectly for Multiple InheritanceLast reviewed: July 22, 1997Article ID: Q104676 |
4.10 | 1.00 1.50 1.51 1.52 4.10
MS-DOS | WINDOWS
kbtool kbcode kbbuglist
The information in this article applies to:
SYMPTOMSExpanding the "this" pointer of a class with multiple inheritance displays incorrect information.
CAUSEThe class type is derived from more than one classes.
STATUSMicrosoft has confirmed this to be a problem in Microsoft CodeView version 4.1 for MS-DOS and Windows and in the Visual Workbench Debugger that ships with Visual C++ for Windows, version 1.0. The problem does not occur with the Visual Workbench Debugger that ships with Visual C++ 32-bit Edition or with CodeView for Win32s version 4.25.
MORE INFORMATIONWhen you debug the sample code below, expanding the this pointer of the class collection in a Watch window displays the following: -this = 0x45CA:0x09A2 -base1 = {...} -base1 = CXX0030: Error: expression cannot be evaluated +base1 = CXX0030: Error: expression cannot be evaluated +base2 = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated -base2 = CXX0030: Error: expression cannot be evaluated +base1 = CXX0030: Error: expression cannot be evaluated +base2 = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated -base2 = {...} +base1 = CXX0030: Error: expression cannot be evaluated +base2 = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated c = 12870The base1 and base2 classes incorrectly appear more than once in the expanding process.
Sample Code
/* * Compiler options needed: /Zi /Od */class base1{ public: int a;}; class base2{ public: int b;}; class collection:public base1,public base2 { public: int c; void sub();};
void collection::sub(){ a=100; // Set a breakpoint here and watch this pointer. b=200; c=300;}
void main(){ collection k; k.sub();}
|
Additional reference words: 4.10 1.00 1.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |