Archived

This topic is now archived and is closed to further replies.

GCC 3.0 Bug with abstract classes?

This topic is 5872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

class PureVirtual { public: virtual ~PureVirtual ( ) = 0; virtual void f ( ) = 0; virtual void g ( ) = 0; }; class Concrete : public PureVirtual { public: Concrete ( ); virtual ~Concrete( ); virtual void f ( ); virtual void g ( ); }; Concrete::Concrete() {} Concrete::~Concrete() {} void Concrete::f ( ) { // do something } void Concrete::g ( ) { // do something } int main ( ) { Concrete c; c.f(); c.g(); return 0; } The above code snippet won''t link with GCC 3.0.1! It produces "undefined reference to `__cxa_pure_virtual''"... also the compiler seems to add delete() - calls to the destructors somewhere. btw. target platform is ARM

Share this post


Link to post
Share on other sites
It''s not a bug. Any derived class'' destructor must call the base class'' destructor, and so even a pure destructor must be defined. It can be empty, though.

Share this post


Link to post
Share on other sites