Jump to content
  • Advertisement

Archived

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

darookie

GCC 3.0 Bug with abstract classes?

This topic is 6089 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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!