virtual destructor unexpected pass

Alexandre Oliva oliva@dcc.unicamp.br
Tue Sep 1 20:22:00 GMT 1998


Todd Vierling <tv@pobox.com> writes:

> It causes a link error that ~A() is undefined; I believe that the
> destructor in A below is an error and there should be a compiler
> error instead.

Nope, it is valid to declare an pure virtual destructor, but it *must*
be defined anyway if you instantiate any subclass of the class.  A
compile-time error would be wrong, because the destructor could be
defined in another translation unit.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list