2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr67055.C
blob5089f092861aab2894dcf5cf05c8df4307607b21
1 // { dg-do compile }
2 // { dg-additional-options "-std=c++14" }
3 // { dg-require-effective-target alloca }
5 namespace std {
6     typedef __SIZE_TYPE__ size_t;
7     struct nothrow_t;
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>
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:
27         D() : B(0) {}
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>
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;
42 void *operator new(std::size_t, std::nothrow_t &) noexcept {
43     return vespamalloc::_GmemP->malloc(0);
45 void *operator new[](std::size_t, std::nothrow_t &) noexcept {
46     return vespamalloc::_GmemP->malloc(0);