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

[Bug c++/7302] -Wnon-virtual-dtor should't complain of protected dtor




------- Comment #25 from cesarb at cesarb dot net  2007-08-21 10:54 -------
The testcase seems to be missing one case where it should warn:

class H
{
protected:
        ~H();
public:
        virtual void deleteme() = 0;
};

H::~H()
{
}

void
H::deleteme()
{
        delete this;
}

class I : public H
{
protected:
        ~I();
public:
        virtual void deleteme() { H::deleteme(); }
        void oops();
};

I::~I()
{
}

void
I::oops()
{
        deleteme();
}

Here, H must have a virtual destructor. The point where it can know it should
warn is the "delete this;" line.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7302

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



Reply to: