Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / operators32.C
blob991e38ddbc4b5fc65ad22c2cf78209a0748c4979
1 // { dg-do assemble  }
2 // GROUPS passed operators
3 #include <iostream>
5 //
6 // ffrees space allocated for N-D array
7 //
9 template <class T>
10 void ffree(long rows, T** array)
12 for( long i = 0; i < rows; i++ )
13   delete [] array[i];                   // delete row
14 delete [] array;                        // delete outer array
17 template <class T>
18 T* allocate1d(long size, T*& array)
20 return array = new T[size];
23 template <class T>
24 T** allocate2d(long d1, long d2, T**& array)
26 if( allocate1d(d1, array) != 0 )
27   {
28   for( long i = 0; i < d1; i++ )
29     {
30     if( allocate1d(d2, array[i]) == 0 )
31       {
32       ffree(i,array);
33       return array;
34       }
35     }
36   }
37 return array;
40 int main()
42 long d1 = 3, d2 = 4;
43 class foo
45 public:
46 foo() {std::cout << "foo created" << std::endl; }
48 ~foo() {std::cout << "foo deleted" << std::endl; }
51 foo **f2;
52 allocate2d(d1, d2, f2);// { dg-error "" "" { target { ! c++11 } } }
53 ffree(d1, f2);// { dg-error "" "" { target { ! c++11 } } }