This is the mail archive of the gcc-patches@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]

Re: inaccessible desctuctor warning a little overzealous


Mike Stump wrote:
The private destructor warning is a little overzealous in this case:

// { dg-options "-Wctor-dtor-privacy" }

class Foo {                             // { dg-bogus "" }
public:
  void release() { delete this; }
  Foo() {}
private:
  ~Foo() {}
};

int main() {
  Foo* f = new Foo;
  f->release();
}

t.cc:3: warning: 'class Foo' only defines a private destructor and has no friends

Ok?

No, that would make the warning basically useless. This is why DJ is adding fine-grained warning control; so that you can turn this off on a selective basis.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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