Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4407

cast between different pointer to member representations, compiler may generate incorrect code

An incorrect cast was detected.

The following sample generates C4407:

// C4407.cpp
// compile with: /W1
struct C1
{
};

struct C2
{
};

struct C3 : C1, C2
{
};

typedef void(C3::*PMF_C3)();
typedef void(C2::*PMF_C2)();

PMF_C2 f1(PMF_C3 pmf)
{
   return (PMF_C2)pmf;   // C4407, change type of cast,
   // or reverse base class inheritance of C3 (i.e. : C2, C1)
}

int main()
{
}
Show:
© 2014 Microsoft