virtual destructor unexpected pass

Reid M. Pinchback reidmp@MIT.EDU
Wed Sep 2 14:00:00 GMT 1998


On 2 Sep 1998 Tod Vierling wrote:

!Then I reassert that the compiler should say something about this - if not
!an error, then a warning.  If it's generating an implicit reference to
!something declared pure virtual (where there is no _intent_ of making a real
!function for the declaration), there should be at least a compiler warning
!to the effect of:
!
!warning: destructor for class `A' is pure virtual, but will be referenced by
!subclasses

This sounds like something comparable to lint-like warnings
for C.  I wouldn't recommend making it a warning message that
was turned on by default, except perhaps via -Wall.  Virtual 
destructors are often necessary for dynamic casts, no?
Pure virtual something-or-others are necessary to stop a 
class from being instantiated by non-subclasses.  Null 
destructor bodies could be a problem in templated classes
where you are trying to exert some control over implicit
conversions and specializations (those link errors become
useful indications that I screwed something up).

I like warning messages too, but I also like a way to keep 
the default ones to a minimum.  Warnings seen all the time
become part of the background noise we learn to ignore.
On the other hand, when I'm really stumped, having a
-Wraving-paranoid-tell-me-everything option is just what
I want.  :-)

====================================================
= Reid M. Pinchback                                =
= I/T Delivery, MIT                                =
=                                                  =
= Email:   reidmp@mit.edu                          =
= URL:     http://web.mit.edu/reidmp/www/home.html =
====================================================




More information about the Gcc-bugs mailing list