| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fgraphite-identity" } */ |
| 3 |
|
| 4 |
template<typename Tp > class vector { }; |
| 5 |
|
| 6 |
template <int rank, int dim> class Tensor; |
| 7 |
|
| 8 |
template <int dim> class Tensor<1,dim> { |
| 9 |
public: |
| 10 |
Tensor (const Tensor<1,dim> &); |
| 11 |
private: |
| 12 |
double values[(dim != 0) ? (dim) : 1]; |
| 13 |
}; |
| 14 |
|
| 15 |
template <int dim> |
| 16 |
#ifdef NOINLINE |
| 17 |
// declaring this noinline prevents the ICE |
| 18 |
__attribute__ ((noinline)) |
| 19 |
#endif |
| 20 |
Tensor<1,dim>::Tensor (const Tensor<1,dim> &p) |
| 21 |
{ |
| 22 |
for (unsigned int i = 0; i < dim; ++i) |
| 23 |
values[i] = p.values[i]; |
| 24 |
} |
| 25 |
|
| 26 |
template <int rank, int dim> |
| 27 |
class Tensor { |
| 28 |
Tensor<rank-1,dim> subtensor[dim]; |
| 29 |
}; |
| 30 |
|
| 31 |
template <int dim> class Base { |
| 32 |
public: |
| 33 |
const unsigned int npoints; |
| 34 |
const unsigned int dofs; |
| 35 |
const Tensor<2,dim> &s2d (const unsigned int fno, |
| 36 |
const unsigned int pno) const; |
| 37 |
void getf2d (vector<Tensor<2,dim> >& d2) const; |
| 38 |
}; |
| 39 |
|
| 40 |
template <int dim> |
| 41 |
void Base<dim>:: getf2d |
| 42 |
(vector<Tensor<2,dim> > &d2) const |
| 43 |
{ |
| 44 |
unsigned int point, sf; |
| 45 |
|
| 46 |
for (point = 0; point < npoints; ++point) |
| 47 |
for (sf = 0; sf < dofs; ++sf) |
| 48 |
Tensor<2,dim> tmp = s2d (sf, point); |
| 49 |
} |
| 50 |
|
| 51 |
template void Base<3>::getf2d (vector<Tensor<2,3> > &) const; |