| 1 |
// { dg-do compile } |
| 2 |
// { dg-require-effective-target c++11 } |
| 3 |
// { dg-additional-options "-Ofast" } |
| 4 |
|
| 5 |
template <typename> class h { |
| 6 |
public: |
| 7 |
~h(); |
| 8 |
}; |
| 9 |
template <typename> struct l; |
| 10 |
template <typename c> struct l<h<c> > { |
| 11 |
using d = c; |
| 12 |
template <typename e> using f = h<e>; |
| 13 |
}; |
| 14 |
template <typename g> struct o { |
| 15 |
typedef l<g> j; |
| 16 |
typedef typename j::d k; |
| 17 |
template <typename c> struct p { typedef typename j::f<c> m; }; |
| 18 |
}; |
| 19 |
template <typename c, typename g> struct F { |
| 20 |
typedef typename o<g>::p<c>::m q; |
| 21 |
struct : q { |
| 22 |
} r; |
| 23 |
}; |
| 24 |
template <typename c, typename g = h<c> > class s : F<c, g> { |
| 25 |
public: |
| 26 |
s(long); |
| 27 |
typename o<typename F<c, g>::q>::k operator[](long); |
| 28 |
}; |
| 29 |
template <int> class t { |
| 30 |
public: |
| 31 |
int dimension; |
| 32 |
t(const t &); |
| 33 |
void operator+=(t); |
| 34 |
double values[]; |
| 35 |
}; |
| 36 |
template <int dim> t<dim>::t(const t &p1) { |
| 37 |
for (int i = 0; i < dim; ++i) |
| 38 |
values[i] = p1.values[i]; |
| 39 |
} |
| 40 |
template <int dim> class u : public t<dim> { |
| 41 |
public: |
| 42 |
double m_fn1(const u &) const; |
| 43 |
}; |
| 44 |
template <int dim> double u<dim>::m_fn1(const u &) const { |
| 45 |
double a; |
| 46 |
for (int i = 0; i < dim; ++i) { |
| 47 |
double b = this->values[i]; |
| 48 |
a += b; |
| 49 |
} |
| 50 |
return a; |
| 51 |
} |
| 52 |
int m_fn2(const u<2> &p1, const u<2> &w) { |
| 53 |
int n; |
| 54 |
s<u<2> > c(n); |
| 55 |
s<double> d(n); |
| 56 |
double e = p1.m_fn1(w); |
| 57 |
for (;;) { |
| 58 |
c[0] += p1; |
| 59 |
d = e; |
| 60 |
} |
| 61 |
} |