BUG: Incorrect Evaluation of Static Member Functions in DebuggeLast reviewed: July 31, 1997Article ID: Q168380 |
The information in this article applies to:
SYMPTOMSFunction evaluation of static member functions cannot be done in the Watch or the QuickWatch window of the debugger. You get the error message "Error:cannot display value," or get a wrong value.
CAUSEThe expression evaluator in the debugger does not properly distinguish between static and non-static methods. The first case listed above appears to be an evaluation of a method without a "this" pointer, hence, we get an "Error:cannot display value" message. The second case occurs because the debugger is not properly distinguishing between static and non-static member functions. The "this" pointer is pushed onto the stack to evaluate the static member function, which is incorrect.
RESOLUTIONThere is no workaround. Do not attempt to evaluate static member functions from within the debugger, either in the watch or quick watch window.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce BehaviorUse the following sample code and build it with debug information.
class A { public: static int bar (int i) {return i;} }; void main () { A f; int j = A::bar(200); int i = f.bar(100); }Start the debugger by stepping into (F11 key) function "main." In the Watch or QuickWatch window, type A::bar(200) and you will get the error message described in the SYMPTOMS section. Typing f.bar(100) produces a wrong value. Keywords : vcbuglist500 WBDebug kbtool Version : 4.0 4.1 4.2 5.0 Platform : NT WINDOWS Issue type : kbbug |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |