summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/placement3.C
blob: 919e2a81617cbc20719828bc8c70be5326c43d91 (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
27
28
29
30
typedef __SIZE_TYPE__ size_t;
extern "C" void *malloc (size_t);

int i;

struct S {
  S(int) { 
    throw 3; 
  }

  void *operator new(size_t s, int)  {
    ++i;
    return malloc (s);
  }

  void operator delete(void *, int)  {
    --i;
  }

  void operator delete(void *, int, int) ;
};

int main () {
  try {
    new (7) S (12);
  } catch (int) {
    if (i)
      return 1;
  }
}