[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



Reply to: