if u have 2 classes defined as: class TPoints { TPoints(const TPoints&); TPoints& operator=(const TPoints&); friend class TPoligon; public: TPoints::TPoints(){} virtual ~TPoints(); }; class TPoligon: public TPoints { TPoligon(const TPoligon&);//not impl TPoligon& operator=(const TPoligon&);//not impl public: TPoligon(){} virtual ~TPoligon(); }; //and the functions TPoints::~TPoligon()// !!!!! <-------- class TPoints and destructor of TPoligon { } TPoints::~TPoints(){} TPoligon::~TPoligon(){} int main(){} the code above compiles without warning!
With the following reduced case: //--------->8 snip 8<------------- class TPoints { public: ~TPoints(); }; class TPoligon: public TPoints { public: ~TPoligon(); }; TPoints::~TPoligon() { } TPoints::~TPoints(){} //--------->8 snip 8<------------ I get this misleading diagnostic with 4.0.1 (don't have 4.0.3 handy): dtor.cc:13: error: redefinition of 'TPoints::~TPoints()' dtor.cc:11: error: 'TPoints::~TPoints()' previously defined here With 4.1, I get: dtor.cc:11: error: declaration of '~TPoligon' as member of 'TPoints'
Fixed in 4.0.3: /tmp> /space/rguenther/install/gcc-4.0.3/bin/g++ -Wall -S t.C t.C:11: error: declaration of '~TPoligon' as member of 'TPoints'