This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15214] Warning non-virtual-dtor too strict


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]