2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr52772.C
blobbc5d3a1ddf503ba892ef994ff60b701c516b850a
1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
4 typedef __SIZE_TYPE__ size_t;
6 class c1;
8 class c2 {
9   public: c2() { };
10   void *operator new(size_t size, const c1 & crc1);
13 class c3 {
14   public: c3() { _Obj = 0; }
15   ~c3() { if (_Obj) delete _Obj; }
16   void set(c2 *pObj);
17   protected: c2 *_Obj;
20 void c3::set(c2 *pObj) { _Obj = pObj; };
22 template<class TYPE> class tc1 : public c2 {
23   public: tc1(int n=0){};
24   int get() const;
25   TYPE& operator[] (int id);
26   TYPE * _data;
27   int _size;
30 template<class TYPE> TYPE & tc1<TYPE>::operator[] (int id) {
31   return _data[id];
34 template<class TYPE> int tc1<TYPE>::get() const {
35   return _size;
38 class c4 {
39   public: c4();
42 class c5 : public c2 {
43   protected: c2 * _own;
44   public: c5(c2 *o) : _own(o) { }
45   c5(const c4 & box);
46   int add(const c4 & ext);
49 class c6 {
50   public: int get() const { return 0; };
53 class c7 {
54   friend class c8;
55   int find(c6 * loop) const;
58 class c8 {
59   const c1 & _rc1;
60   int tria(c7 * face, c5 * vtree0 = 0);
63 int c8::tria(c7 * face, c5 * vtree0) {
64   c6 *sLData[64];
65   tc1<c6*> loops(64);
66   while (loops.get() > 1) { 
67     c6 *iloop = 0; 
68     for (int j=1; j<loops.get(); j++) { 
69       if (loops[j]->get() < 32) { 
70         iloop = loops[j];
71       }
72     }
73     face->find(iloop);
74   }
75   c4 box;
76   c3 ctree;
77   c5 *vtree = vtree0;
78   if (!vtree) { 
79     vtree = new (_rc1) c5(box); 
80     ctree.set(vtree); 
81     for (int j=0; j<1; j++) { 
82       c4 sVBBox; 
83       vtree->add(sVBBox);
84     }
85   }