Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.oliva / delete1.C
blob368a87a2a9a25544fe0c5744f03f17bad67ed018
1 // { dg-do assemble  }
3 // Copyright (C) 1999, 2001 Free Software Foundation
5 // by Alexandre Oliva <oliva@dcc.unicamp.br>
6 // simplified from bug report by K. Haley <khaley@bigfoot.com>
7 // based on analysis by Martin v. Loewis
9 // [class.dtor]/11: delete must be implicitly checked for
10 // accessibility only in the definition of virtual destructors,
11 // implicitly defined or not.
13 struct foo {
14   foo() {}
15 private:
16   void operator delete(void *) {} // { dg-error "" } private
17 } foo_;
19 struct bar : foo {
20   ~bar() {
21     delete this; // { dg-error "" } delete is private
22     // An implicit invocation of delete is emitted in destructors, but
23     // it should only be checked in virtual destructors
24   } // { dg-bogus "" } not virtual
25 } bar_;
27 struct baz : foo {
28   virtual ~baz() {} // { dg-error "" } delete is private in vdtor
29 } baz_;
31 struct bad : baz {} bad_; // { dg-message "" } delete is private in vdtor