FIX: Access Violation When Using Local Static Const ObjectsLast reviewed: September 18, 1997Article ID: Q124291 |
1.00 2.00
WINDOWS NT
kbprg kbtool kbfixlist
The information in this article applies to:
The Microsoft C/C++ Compiler (CL.EXE) included with - Microsoft Visual C++, 32-bit Edition, versions 1.0 and 2.0
SYMPTOMSInstantiating a class object that is defined as a local static const may cause runtime access violations. For example, if you run the sample code listed in the "More Information" section of this article, it triggers the system error dialog box to appear with either the application error or the following text at run time:
Unhandled Exception in xxxx.exe: 0xC0000005: Access Violation RESOLUTIONTo work around this problem, use one of these suggestions:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Visual C++, 32-bit Edition, version 4.0.
MORE INFORMATION
Sample Code to Reproduce Problem
/* Compile options needed: none */class A { public: A(int i){ m_i = i; } int m_i;};
void main(void){ static const A a1(5);}
|
Additional reference words: 9.00 8.00 1.00 2.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |