PR testsuite/86649
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr27283.C
blob1623d289a20431d7a21e508fbeb9bdecbb53979f
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-options "-Wno-return-type" } */
5 namespace Gambit
7   template < class T > class Array
8   {
9   protected:int mindex, maxdex;
10     T *data;
11     int InsertAt (const T & t, int n)
12     {
13       T *new_data = new T[++this->maxdex - this->mindex + 1] - this->mindex;
14       int i;
15       for (i = this->mindex; i <= n - 1; i++)
16           new_data[i] = this->data[i];
17     }
18   public:   Array (unsigned int len = 0):mindex (1), maxdex (len),
19       data ((len) ? new T[len] -
20             1 : 0)
21     {
22     }
23     virtual ~ Array ()
24     {
25       if (maxdex >= mindex)
26         delete[](data + mindex);
27     }
28     const T & operator[] (int index) const
29     {
30     }
31     int Append (const T & t)
32     {
33       return InsertAt (t, this->maxdex + 1);
34     }
35   };
37 class gIndexOdometer
39 private:Gambit::Array < int >MinIndices;
40     Gambit::Array < int >CurIndices;
41     gIndexOdometer (const Gambit::Array < int >, const Gambit::Array < int >);
42   void SetIndex (const int &, const int &);
43   int NoIndices () const;
44   gIndexOdometer AfterExcisionOf (int &) const;
46 gIndexOdometer
47 gIndexOdometer::AfterExcisionOf (int &to_be_zapped) const
49   Gambit::Array < int >NewMins, NewMaxs;
50   int i;
51   for (i = 1; i <= NoIndices (); i++)
52     {
53       NewMins.Append (MinIndices[i]);
54     }
55   gIndexOdometer NewOdo (NewMins, NewMaxs);
56     NewOdo.SetIndex (i, CurIndices[i]);