views:

69

answers:

2

Hi All,

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

A: 

Just guessing, been a while since I did MFC but it looks like it gets confused of your multiple inheritance

BEGIN_MESSAGE_MAP( class, baseclass )

expands to calling a method in 'class' so since A is multiple inherited its uncertain which of them to use, maybe you have the same method in several of the base classes?

Anders K.
no the base classes dont have any of the same methods
Gamer
+1  A: 

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.

Ruddy