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