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