We have the following class structure in our code
Class A: public CDialog, public Base1, public Base2
{
};
In implementation of Class A we have the following:
BEGIN_MESSAGE_MAP( A, CDialog )
ON_WM_SIZE()
END_MESSAGE_MAP()
Please note Base1 and Base2 doesn't inherit from CDialog or any other MFC classes.
On VC6 the compilation is successful. But on VC9 we get the following error code:
error C4407: cast between different pointer to member representations, compiler may generate incorrect code.
This error code is pointing to the location of ON_WM_SIZE.
Could anyone possibly tell me a solution. Thanks in advance.
Gamer
I just solved an instance of this problem; found this question with a web search.
In my case I also had a dialog class inheriting from more than one class: CDialog and ConfigurationTab, which is an internal interface. The compiler warning was silenced by changing:
class Foo : public ConfigurationTab, public CDialog
with:
class Foo : public CDialog, public ConfigurationTab
We discovered this situation when the offending dialog crashed inside a ON_BN_CLICKED method at an assignment to a DDX variable. The DDX variable was mysteriously uninitialized at that line, when we were sure it was initialized.
I don't have an installed V9 handy, but i can see that between VS6 and VC8 the ON_WM_SIZE define has changed to be semantically the same but far more stringent in what it accepts. VC6 used C casts, where VC8 is using C++ casts which catch more problems.
We would need to see the actual declaration from your class of the OnSize method i think to be able to determine what is going wrong here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With