[gnu.g++.help] Yet another G++ question

niklas@appli.se (Niklas Hallqvist) (10/26/90)

Is this code really legal? G++ 1.37.1 (+ some early bug fixes of 1.37.2) says so!

class A { public: virtual ~A() = 0; };
class B : virtual public A {};
void foo(void) { B b; }

Doesn't B have to implement a destructor when deriving <<VIRTUALLY>>
from A?  Why, if that's the case?  If I derive B non-virtually from
A, I get the expected error message.  Is it a bug?  If so, is it
fixed in the current version of G++ (whatever that is)?  If not,
how can i ensure that every class deriving from A (virtually or not)
must implement a destructor?  I did really forget to write down a
destructor, but I trusted the compiler to tell me my mistakes, since
I was awfully concentrated when writing the abstract base class, just
in order to prevent such a malicious fault go unnoticed.

				Niklas
-- 
Niklas Hallqvist	Phone: +46-(0)31-40 75 00
Applitron Datasystem	Fax:   +46-(0)31-83 39 50
Molndalsvagen 95	Email: niklas@appli.se
S-412 63  GOTEBORG, Sweden     mcsun!sunic!chalmers!appli!niklas