I wonder if any C ++ gurus can shed light on this strange situation. One example that comes with the Box2D physics engine breaks down with the message "pure virtual method", but only with a specific compiler (and only in the build version).
Box2D, as you may know, is a pretty solid piece of code, so I think this may be a problem with the compiler, especially considering that this only happens with this particular compiler. I am using mingw32 on Windows7:
> gcc.exe --version
gcc version 4.4.0 (GCC)
The following is a clipping from the relevant parts of Box2D. You can check the full source at:
b2Shape.h
b2CircleShape.h
b2CircleShape.cpp
SensorTest.h
class b2Shape
{
public:
virtual ~b2Shape() {}
virtual b2Shape* Clone(b2BlockAllocator* allocator) const = 0;
};
class b2CircleShape : public b2Shape
{
public:
b2CircleShape();
b2Shape* Clone(b2BlockAllocator* allocator) const;
};
inline b2CircleShape::b2CircleShape() {}
b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2CircleShape));
b2CircleShape* clone = new (mem) b2CircleShape;
*clone = *this;
return clone;
}
Clone.
, , :
{
b2CircleShape shape;
shape.Clone(allocator);
}
{
b2CircleShape shape;
shape.Clone(allocator);
}
, , - , , , , .
, , , b2CircleShape , . , , vtable , , . - , , vtable ...?
, , , , , .
№ 1 , . , , , . (, , "" . , ~ b2Shape() {}, , , ? , ...)
2, , 'inline' . , - , , . (: , )
, , , inline, , , , "inline"?