blob: 6621e58136fe078436d8763188a25dbf46a2a1a1 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// { dg-do compile }
// { dg-additional-options "-std=c++14" }
namespace std {
typedef __SIZE_TYPE__ size_t;
struct nothrow_t;
}
namespace vespamalloc {
void fn1(void *);
template <typename> class A {
public:
static unsigned long fillStack(unsigned long);
};
template <typename StackRep>
unsigned long A<StackRep>::fillStack(unsigned long p1) {
void *retAddr[p1];
fn1(retAddr);
return 0;
}
class B {
protected:
B(void *);
};
template <int StackTraceLen> class D : B {
public:
D() : B(0) {}
void alloc(int) { A<int>::fillStack(StackTraceLen); }
};
template <typename, typename> class C {
public:
void *malloc(unsigned long);
};
template <typename MemBlockPtrT, typename ThreadListT>
void *C<MemBlockPtrT, ThreadListT>::malloc(unsigned long) {
MemBlockPtrT mem;
mem.alloc(0);
return 0;
}
C<D<16>, int> *_GmemP;
}
void *operator new(std::size_t, std::nothrow_t &) noexcept {
return vespamalloc::_GmemP->malloc(0);
}
void *operator new[](std::size_t, std::nothrow_t &) noexcept {
return vespamalloc::_GmemP->malloc(0);
}
|