Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.mike/p710.C

raw
1 // { dg-do assemble }
2 // { dg-skip-if "requires hosted libstdc++ for stdlib size_t" { ! hostedlib } }
3
4 // GROUPS passed delete
5 /*
6 Bug Id:
7 PRMS Id: p0000710
8 Bug is : overloading operator delete in class def not allowed
9 */
10
11 /*
12 In addition to this bug, the compiler permits overloading operator
13 delete in the class definition. This is verboten, and should be
14 caught by a regression suite. In other words, the following is also a
15 bug that's not caught:
16 */
17
18
19 #include <stdlib.h>
20
21 extern "C"
22 {
23 int printf(const char*, ...);
24 }
25
26
27
28 class B
29 {
30 public:
31 int x;
32 virtual ~B() {}
33 void operator delete(void*,size_t s)
34 {
35 printf("B::delete() %d\n",s);
36 }
37 void operator delete(void*){}
38 };
39
40 int main()
41 {
42 B* p = new B;
43 delete p;
44 return 0;
45 }