[comp.lang.c++] 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

jfjr@mbunix.mitre.org (Freedman) (10/27/90)

  I have a Sun 3 running 3.4 (suggestions to upgrade
are not helpful - I would if I could).
I have installed the gcc compiler apparently successfully.
I am struggling with the g++ and the lib (gcc-1.37.1,g++1.37.2)
I g++ compiles with two warnings - MAP_FIXED is undefined
I #defined it as zero, and there is a pointer assignment
problem (a pointer to fancy_abort is assigned to another
function pointer but since it is an abort I didn't worry)
both in toplev.

  I had to compile with the FASCIST_ASSEMBLER flag on.
Okay, now, here's the problem. In building the libg++
gnulib3 is compiled no complaints. Then I do "make tests"
and it bombs because __CTOR_LIST__ and __DTOR__ list
are referenced in the gnulib3 text segment but undefined.
I believe I have a malformed crt1+.o but I am not sure.
(the g++ build doesn't build gnulib3, collect or collect2)
I think I just have a minor configuration problem in
my g++ but I can't track it down. Help,advice,pointers,
prayers and good luck charms are all welcome

                           Jerry Freedman,Jr
                            617 271 8305