FIX: Incorrect Debugging Information for Nested Classes

ID: Q102166

1.00    | 1.00
WINDOWS | WINDOWS NT kbtool kbbuglist kbfixlist kbfasttip

The information in this article applies to:

SYMPTOMS

An attempt to expand a local variable in the Local or Watch window may fail and display incorrect values.

CAUSE

The data type of the local variable uses nested classes.

RESOLUTION

To work around this problem, specify the /Z7 compiler option switch when you build the application.

STATUS

Microsoft has confirmed this to be a problem in the C/C++ Compiler (CL.EXE) version 8.0 for Windows. This problem was corrected in C/C++ compiler version 8.0c, included in Visual C++ for Windows, version 1.5.

MORE INFORMATION

When you debug the code example below in Visual C++ version 1.0, the local objects a and b refer to nested class C defined in class A when you expand the objects. This problem does not occur in Microsoft C/C++ version 7.0 for MS-DOS.

Sample Code

/*
 * Compiler options needed: /Zi /Od
 */ 

class A { public:
   class C
   {
   public:
      int *a;
   };
   C *temp;
};

class B { public:

   class C
   {
   public:
      float *a;
   };
   C *temp;
};

void main(void)
{
   A a; B b;   // b refers to nested class C defined in class A
}

Additional reference words: 1.00 8.00 KBCategory: kbtool kbfixlist kbfasttip kbbuglist KBSubcategory: CPPIss
Keywords          : kb16bitonly kbCompiler kbCPPonly kbVC kbbuglist kbfixlist
Version           : 1.00    | 1.00
Platform          : NT WINDOWS
Solution Type     : kbfix

Last Reviewed: September 20, 1997