Dear G++ Folk, An astute student found the following example: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv class foo1 { public: virtual void f1 (void) {} virtual ~foo1 (void); }; class foo2 : public foo1 { public: ~foo2 (void); }; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We believe the compiler should at least warn that foo2 has a virtual function, and non-virtual dtor. Thank you for your time! ATB, Aaron Naiman -- Aaron ("Aharon") Naiman | Jerusalem College of Technology--Machon Lev naiman@math.jct.ac.il | http://math.jct.ac.il/~naiman
foo2 does have a virtual destructor. Whether you write the "virtual" keyword or not is irrelevant.
Subject: Re: New: no warning of non-virtual dtor in subclass naiman at math dot jct dot ac dot il: > Dear G++ Folk, > > An astute student found the following example: > > vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > class foo1 { > public: > virtual void f1 (void) {} > virtual ~foo1 (void); > }; > > class foo2 : public foo1 { > public: > ~foo2 (void); > }; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > We believe the compiler should at least warn that foo2 > has a virtual function, and non-virtual dtor. You're mistaken: foo2 has a virtual destructor. The PR is invalid.