1 // { dg-do run }
2 #include <new>
3
4 int i;
5
6 extern "C" int printf (const char *, ...);
7
8 template <class T, class U>
9 struct map {
10 ~map ();
11 };
12
13 template <class T, class U>
~map()14 map<T, U>::~map ()
15 {}
16
17 struct SomeClass { };
18
new(std::size_t numBytes,SomeClass &,const std::nothrow_t &)19 void* operator new(std::size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
20 {
21 return operator new(numBytes, std::nothrow);
22 }
23
delete(void * pMemory,SomeClass &,const std::nothrow_t &)24 void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw()
25 {
26 i = 7;
27 return operator delete(pMemory);
28 }
29
30 int
main()31 main()
32 {
33 map< int, int>* pMap = new map< int, int>;
34
35 delete pMap;
36
37 if (i == 7)
38 return 1;
39 }
40