blob: 9c61eca2b04619b785e154b128beeae9d7602263 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// PR c++/34158
typedef __SIZE_TYPE__ size_t;
extern "C" void* malloc (size_t);
extern "C" void free (void *);
template <class T> class undef;
struct A {
A() { throw 1; }
};
template<typename T> class Pool { };
void *operator new(size_t size,Pool<int>& pool)
{
return malloc(size);
}
template<typename T>
void operator delete(void *p,Pool<T>& pool)
{
undef<T> t; // { dg-error "incomplete" }
free(p);
}
int main ()
{
Pool<int> pool;
new (pool) A(); // { dg-message "instantiated" }
return 0;
}
|