summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/delete3.C
blob: 9c6c58e966e265547ae0190a1acb9ad945b4805c (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
31
32
33
34
35
36
37
38
39
// { dg-do run  }
#include <new>

int i;

extern "C" int printf (const char *, ...);

template <class T, class U> 
struct map {
  ~map ();
};

template <class T, class U>
map<T, U>::~map ()
{}

struct SomeClass { };

void* operator new(std::size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
{
  return operator new(numBytes, std::nothrow);
}

void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw()
{
  i = 7;
  return operator delete(pMemory);
}

int
main()
{
  map< int, int>* pMap = new map< int, int>;
  
  delete pMap;
  
  if (i == 7)
    return 1;
}