1 // { dg-do run } 2 // { dg-options "-fcheck-new -pedantic -Wno-long-long" } 3 // PRMS Id: 6037 4 5 extern "C" void * malloc (__SIZE_TYPE__); 6 7 int ena = 0; 8 9 struct A { 10 int i; AA11 A () { i = 2; } operator newA12 void * operator new (__SIZE_TYPE__ s) 13 { 14 if (ena) 15 return 0; 16 return malloc (s); 17 } 18 }; 19 20 struct B { 21 int i; BB22 B () { i = 2; } operator newB23 void * operator new (__SIZE_TYPE__ s) throw() 24 { 25 if (ena) 26 return 0; 27 return malloc (s); 28 } 29 }; 30 main()31int main () 32 { 33 ena = 1; 34 A *ap = new A; 35 B *bp = new B; 36 37 return ap || bp ; 38 } 39