| 1 |
// PR c++/34158 |
| 2 |
|
| 3 |
// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'. |
| 4 |
|
| 5 |
typedef __SIZE_TYPE__ size_t; |
| 6 |
extern "C" void* malloc (size_t); |
| 7 |
extern "C" void free (void *); |
| 8 |
|
| 9 |
template <class T> class undef; |
| 10 |
|
| 11 |
struct A { |
| 12 |
A() { throw 1; } |
| 13 |
}; |
| 14 |
|
| 15 |
template<typename T> class Pool { }; |
| 16 |
|
| 17 |
void *operator new(size_t size,Pool<int>& pool) |
| 18 |
{ |
| 19 |
return malloc(size); |
| 20 |
} |
| 21 |
|
| 22 |
template<typename T> |
| 23 |
void operator delete(void *p,Pool<T>& pool) |
| 24 |
{ |
| 25 |
undef<T> t; // { dg-error "incomplete" } |
| 26 |
free(p); |
| 27 |
} |
| 28 |
|
| 29 |
int main () |
| 30 |
{ |
| 31 |
Pool<int> pool; |
| 32 |
new (pool) A(); // { dg-message "required" } |
| 33 |
return 0; |
| 34 |
} |