summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/new3.C
blob: ede3a00e9dd003b6c3817f3d874809c403747895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PRMS Id: 6037
// Special g++ Options: -fcheck-new

extern "C" void * malloc (__SIZE_TYPE__);

struct A {
  int i;
  A () { i = 2; }
};

int ena = 0;
void * operator new (__SIZE_TYPE__ s)
{
  if (ena)
    return 0;
  return malloc (s);
}

main ()
{
  ena = 1;
  A* ap = new A;
}