| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
#include <memory> |
| 4 |
|
| 5 |
template<typename T> |
| 6 |
struct Alloc |
| 7 |
{ |
| 8 |
Alloc() = default; |
| 9 |
|
| 10 |
template<typename U> Alloc(const Alloc<U>&) { } |
| 11 |
|
| 12 |
using value_type = T; |
| 13 |
|
| 14 |
T* allocate(unsigned n) |
| 15 |
{ return std::allocator<T>().allocate(n); } |
| 16 |
|
| 17 |
void deallocate(T* p, unsigned n) |
| 18 |
{ return std::allocator<T>().deallocate(p, n); } |
| 19 |
|
| 20 |
template<typename U> void destroy(U* p){ p->~U(); } |
| 21 |
}; |
| 22 |
|
| 23 |
|
| 24 |
class S |
| 25 |
{ |
| 26 |
~S() = default; |
| 27 |
|
| 28 |
friend Alloc<S>; |
| 29 |
}; |
| 30 |
|
| 31 |
void |
| 32 |
test_pr108619(Alloc<int> a, S* p) |
| 33 |
{ |
| 34 |
std::allocator_traits<Alloc<int>>::construct(a, p); |
| 35 |
} |