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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.ns/] [template9.C] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Produces ICE 980519.
3
// Test case from Dirk Engelmann 
4
 
5
namespace vector {
6
 
7
  // allocate memory for vector
8
 
9
        template 
10
        inline T* alloc(const int aWidth)
11
        {
12
                // allocate memory
13
                return new T[aWidth];
14
        }
15
 
16
}
17
 
18
namespace matrix {
19
 
20
  // allocate memory for matrix
21
        template 
22
        T** alloc(const int aWidth,const int aHeight)
23
        {
24
                // allocate memory
25
                T **mat = vector::alloc(aHeight);
26
                T *data = vector::alloc (aWidth*aHeight);
27
                // set pointer
28
                for (int i=0; i
29
                        mat[i] = &data[aWidth*i];
30
                // ok
31
                return mat;
32
        }
33
 
34
}
35
 
36
int main(void)
37
{
38
  // sample
39
  double **m=matrix::alloc(10,20);
40
 
41
}

powered by: WebSVN 2.1.0

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