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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-05 
17:13:02 UTC ---
private inheritance doesn't mean the destructor can't be called with the wrong
static type

class Foo {
public:
    ~Foo() {}
    virtual void f() { }
};

class Bar : private Foo {
public:
    Foo* get() { return this; }
};

int main()
{
    Bar* b = new Bar;
    delete b->get();
}

as stated in PR 16166 comment 3, the 3rd edition of Effective C++ changes the
guideline, and -Wdelete-non-virtual-dtor is usually a better option anyway

Reply via email to