Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr67055.C

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