BUG: Browser Information Shows Incorrect Reference to Variable

Last reviewed: July 24, 1997
Article ID: Q116325
The information in this article applies to:
  • Microsoft Visual C++ for Windows, versions 1.0, 1.5
  • Microsoft Visual C++, 32-bit Edition, versions 1.0, 2.0, 2.1, 4.0, 4.1, 4.2, 5.0

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.

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.

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.


Keywords : TlsMisc vcbuglist400 vcbuglist500
Version : 1.0 1.5 1.1 2.0 2.1 4.0 4.1 4.2
Platform : NT WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.