aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.mike/net46.C
blob: a2362325452d64ce72a2244f38ca56256644ddce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// { dg-do run  }
#include <iostream>
#include <cstdlib>
#include <cstddef>
#include <new>

int fail = 1;

int in_main = 0;

void *operator new(size_t size)
#if __cplusplus <= 199711L
  throw (std::bad_alloc)
#endif
{
  if (!in_main) return malloc (size);
  --fail;
  return (void*) 0;
}

int main() {
  std::cout << "";
  in_main = 1;
  new int;
  return fail;
}