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