1 // { dg-do compile }
2 // { dg-additional-options "-std=c++14" }
3 // { dg-require-effective-target alloca }
4 
5 namespace std {
6     typedef __SIZE_TYPE__ size_t;
7     struct nothrow_t;
8 }
9 namespace vespamalloc {
10     void fn1(void *);
11     template <typename> class A {
12     public:
13 	static unsigned long fillStack(unsigned long);
14     };
15     template <typename StackRep>
fillStack(unsigned long p1)16 	unsigned long A<StackRep>::fillStack(unsigned long p1) {
17 	    void *retAddr[p1];
18 	    fn1(retAddr);
19 	    return 0;
20 	}
21     class B {
22     protected:
23 	B(void *);
24     };
25     template <int StackTraceLen> class D : B {
26     public:
D()27 	D() : B(0) {}
alloc(int)28 	void alloc(int) { A<int>::fillStack(StackTraceLen); }
29     };
30     template <typename, typename> class C {
31     public:
32 	void *malloc(unsigned long);
33     };
34     template <typename MemBlockPtrT, typename ThreadListT>
malloc(unsigned long)35 	void *C<MemBlockPtrT, ThreadListT>::malloc(unsigned long) {
36 	    MemBlockPtrT mem;
37 	    mem.alloc(0);
38 	    return 0;
39 	}
40     C<D<16>, int> *_GmemP;
41 }
new(std::size_t,std::nothrow_t &)42 void *operator new(std::size_t, std::nothrow_t &) noexcept {
43     return vespamalloc::_GmemP->malloc(0);
44 }
45 void *operator new[](std::size_t, std::nothrow_t &) noexcept {
46     return vespamalloc::_GmemP->malloc(0);
47 }
48