This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15214] Warning non-virtual-dtor too strict
- From: "tmarshall at real dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 May 2004 19:03:58 -0000
- Subject: [Bug c++/15214] Warning non-virtual-dtor too strict
- References: <20040430001804.15214.tmarshall@real.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tmarshall at real dot com 2004-05-11 19:03 -------
(In reply to comment #6)
> I don't quite understand the usefulness of the construct you want the
> compiler to accept: if the destructor can't be called from a derived
> class, then you can derive from this class. Why would you want to have
> virtual functions then?
The class may derive from base class(es) that have virtual functions. This is
a common construct in COM programming, for example. The class implements one or
more interfaces (class definitions that consist of pure virtual functions) and
uses "delete this" in its Release() method. Making the dtor private helps to
ensure that it is being used properly.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15214