Knowledge Base |

# BUG: Browser Information Shows Incorrect Reference to Variable

Article ID: 116325

Article Last Modified on 12/1/2003

APPLIES TO

- Microsoft Visual C++ 1.0 Professional Edition
- Microsoft Visual C++ 1.5 Professional Edition
- Microsoft Visual C++ 4.0 Standard Edition
- Microsoft Visual C++ 4.1 Subscription
- Microsoft Visual C++ 4.2 Enterprise Edition
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 4.2 Professional Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition

This article was previously published under Q116325

## SYMPTOMS

When browsing for the definitions and references for a member variable of a class, one of the references refers to the last brace in the destructor of the class.

## CAUSE

The compiler is emitting a reference for this variable in the class destructor. There is an implicit reference to the variable at this point, but not an explicit source-code reference. Therefore, the compiler should not be emitting the reference information.

## RESOLUTION

## STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

## MORE INFORMATION

Perform the following steps to reproduce this problem:

1. Build a test application called "Test", using AppWizard (default settings).
2. Edit TESTDOC.H and add a member variable to the CTestDoc class as follows:

          // Attributes
          public:
              CString Hello; // add this line

3. Edit TestDoc.cpp and initialize the member variable in the OnNewDocument member function:

          BOOL CTestDoc::OnNewDocument()
          {
              if (!CDocument::OnNewDocument())
                  return FALSE;

              Hello = "Hello World"; // add this line
              return TRUE;
          }

4. Build the program and open Microsoft Browser.
5. Query the Definitions and References for "CTestDoc::Hello".

The first reference to CTestDoc::Hello found in TESTDOC.CPP actually points to the ending brace of the CTestDoc destructor. Only the second reference is correct, pointing to the source code reference that was added in the CTestDoc::OnNewDocument() function.

Additional query words: kbVC400bug kbvc100 kbvc150 kbvc110 kbvc200 kbvc210 kbvc410 kbvc420 kbvc500 kbvc600

Keywords: kbbug kbnofix KB116325