The information in this article applies to:
SYMPTOMSWhen the DYNAMIC_DOWNCAST and STATIC_DOWNCAST macros are called, and a pointer to a "const" object is passed, you see an error message similar to the following in debug mode: In release builds, the application hangs. CAUSEThe DYNAMIC_DOWNCAST and STATIC_DOWNCAST macros invoke the AfxDynamicDownCast and AfxStaticDownCast functions respectively. A code defect in Visual C++ version 4.1 causes these calls to be recursive if the object pointer passed as the second parameter to either macro points to a "const" object. The end result is a stack overflow. RESOLUTIONTo work around this problem, remove the "const" attribute for the object pointer in the call to the appropriate DOWNCAST macro. You can do this by using the "const_cast" operator as follows:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 32-bit Edition version 4.2. Additional query words: MfcMisc
Keywords : kbMFC kbVC400bug kbVC420fix |
Last Reviewed: July 26, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |