Compiler Warning C4959
Visual Studio 2005
Error Message
cannot define unmanaged struct 'type' in /clr:safe because accessing its members yields unverifiable codeAccessing a member of an unmanaged type will produce an unverifiable (peverify.exe) image.
For more information, see Pure and Verifiable Code.
This warning is issued as an error and can be disabled with the warning pragma or the /wd compiler option.
The following sample generates C4959:
// C4959.cpp
// compile with: /clr:safe
// Uncomment the following line to resolve.
// #pragma warning( disable : 4959 )
struct X {
int data;
};
int main() {
X x;
x.data = 10; // C4959
}