OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [operators32.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// GROUPS passed operators
3
#include 
4
 
5
//
6
// ffrees space allocated for N-D array
7
//
8
 
9
template 
10
void ffree(long rows, T** array)
11
{
12
for( long i = 0; i < rows; i++ )
13
  delete [] array[i];                   // delete row
14
delete [] array;                        // delete outer array
15
}
16
 
17
template 
18
T* allocate1d(long size, T*& array)
19
{
20
return array = new T[size];
21
}
22
 
23
template 
24
T** allocate2d(long d1, long d2, T**& array)
25
{
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;
38
}
39
 
40
int main()
41
{
42
long d1 = 3, d2 = 4;
43
class foo
44
{
45
public:
46
foo() {std::cout << "foo created" << std::endl; }
47
 
48
~foo() {std::cout << "foo deleted" << std::endl; }
49
};
50
 
51
foo **f2;
52
allocate2d(d1, d2, f2);// { dg-error "" }  type.*// ERROR -    trying to.*
53
ffree(d1, f2);// { dg-error "" }  type.*// ERROR -    trying to.*
54
 
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.