1/* { dg-do compile } */
2/* { dg-options "-O2 -fgraphite-identity" } */
3
4template<typename Tp > class vector { };
5
6template <int rank, int dim> class Tensor;
7
8template <int dim> class Tensor<1,dim> {
9public:
10  Tensor (const Tensor<1,dim> &);
11private:
12  double values[(dim != 0) ? (dim) : 1];
13};
14
15template <int dim>
16#ifdef NOINLINE
17// declaring this noinline prevents the ICE
18__attribute__ ((noinline))
19#endif
20Tensor<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
26template <int rank, int dim>
27class Tensor {
28  Tensor<rank-1,dim> subtensor[dim];
29};
30
31template <int dim> class Base {
32public:
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
40template <int dim>
41void 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
51template void Base<3>::getf2d (vector<Tensor<2,3> > &) const;
52