After about 6 o 7 years programming nearly exclusively on C++, I've discovered that:
struct A
{
virtual ~A() = 0; // Abstract class
};
A::~A() {}
struct B : virtual A
{};
int main()
{
A* a = new B;
(void)static_cast<B*>(a);
return 0;
}
throws a compiler error, because the standard doesn't allow to make a static cast from a pointer to a virtual base class. I assume that that's related to the memory layout associated to a virtual base class, but I would like to know the details.