Hello!
I would like to have some input on this obscure feature of the
language. First some code to clarify the issue:
1 2 3 4 5 6 7 8 9 10 11 12
class Base {
public:
void member() { cout << "test" << endl; }
};
class Derived : publicvirtual Base {};
int main() {
Derived obj;
void (Derived::* pMem)() = &Derived::member; // (*)
(obj.*pMem)();
}
The line marked with (*) triggers an error in g++ and as far as I
know, the standard describes it as ill formed. Microsoft Visual
C++ 2010 shows an "IntelliSense" error in the editor but the
compiler itself does not even issue a warning.
My question is: If this code is ill formed, why does it seem, that
Microsoft created an extra member pointer structure (which is 12
bytes in size on a 32-bit system) to support such a program?