OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [operators32.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do assemble  }
// { dg-do assemble  }
// GROUPS passed operators
// GROUPS passed operators
#include 
#include 
//
//
// ffrees space allocated for N-D array
// ffrees space allocated for N-D array
//
//
template 
template 
void ffree(long rows, T** array)
void ffree(long rows, T** array)
{
{
for( long i = 0; i < rows; i++ )
for( long i = 0; i < rows; i++ )
  delete [] array[i];                   // delete row
  delete [] array[i];                   // delete row
delete [] array;                        // delete outer array
delete [] array;                        // delete outer array
}
}
template 
template 
T* allocate1d(long size, T*& array)
T* allocate1d(long size, T*& array)
{
{
return array = new T[size];
return array = new T[size];
}
}
template 
template 
T** allocate2d(long d1, long d2, T**& array)
T** allocate2d(long d1, long d2, T**& array)
{
{
if( allocate1d(d1, array) != 0 )
if( allocate1d(d1, array) != 0 )
  {
  {
  for( long i = 0; i < d1; i++ )
  for( long i = 0; i < d1; i++ )
    {
    {
    if( allocate1d(d2, array[i]) == 0 )
    if( allocate1d(d2, array[i]) == 0 )
      {
      {
      ffree(i,array);
      ffree(i,array);
      return array;
      return array;
      }
      }
    }
    }
  }
  }
return array;
return array;
}
}
int main()
int main()
{
{
long d1 = 3, d2 = 4;
long d1 = 3, d2 = 4;
class foo
class foo
{
{
public:
public:
foo() {std::cout << "foo created" << std::endl; }
foo() {std::cout << "foo created" << std::endl; }
~foo() {std::cout << "foo deleted" << std::endl; }
~foo() {std::cout << "foo deleted" << std::endl; }
};
};
foo **f2;
foo **f2;
allocate2d(d1, d2, f2);// { dg-error "" }  type.*// ERROR -    trying to.*
allocate2d(d1, d2, f2);// { dg-error "" }  type.*// ERROR -    trying to.*
ffree(d1, f2);// { dg-error "" }  type.*// ERROR -    trying to.*
ffree(d1, f2);// { dg-error "" }  type.*// ERROR -    trying to.*
}
}
 
 

powered by: WebSVN 2.1.0

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