Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.jason/new3.C

raw
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;
11 A () { i = 2; }
12 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;
22 B () { i = 2; }
23 void * operator new (__SIZE_TYPE__ s) throw()
24 {
25 if (ena)
26 return 0;
27 return malloc (s);
28 }
29 };
30
31 int main ()
32 {
33 ena = 1;
34 A *ap = new A;
35 B *bp = new B;
36
37 return ap || bp ;
38 }