This is the mail archive of the
mailing list for the GCC project.
A simple question about virtual destructors.
- From: K <kyb22 at rol dot ru>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 2 Jun 2016 12:55:21 +0300
- Subject: A simple question about virtual destructors.
- Authentication-results: sourceware.org; auth=none
My question is what if a compiler will generate a virtual destructor (or
convert a nonvirtual to virtual) in a base class if the base class has
at least one virtual function and classes down in the hierarchy have
nontrivial destructors? In other words make a compiler responsible for
proper destruction of a polymorphic object.
Are there any serious pros against this? This suggestion can look
stupid but just think how many type strokes and hours in searching of
memory leaks this could save.