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