------- Comment #6 from jwakely dot gcc at gmail dot com  2008-11-01 16:18 
-------
This is a compile-time test which should fail because undef<T> cannot be
instantiated, but the deallocation function is not used.

#include <stdlib.h>

template <class T> class undef;

struct A {
  A() { throw 1; }
};

template<typename T> class Pool { };

template<typename T>
inline void *operator new(size_t size,Pool<T>& pool)
{
  return malloc(size);
}

template<typename T>
inline void operator delete(void *p,Pool<T>& pool)
{
  undef<T> t;
  free(p);
}

int main ()
{
  Pool<int> pool;
  new (pool) A();
  return 0;
}


-- 

jwakely dot gcc at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely dot gcc at gmail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158

Reply via email to