Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / template / memclass4.C
blob65a42a4c2ad8fb9d071b4027d60d0dd71eda5e4d
1 // Origin: PR c++/42824
2 // { dg-do compile }
4 template<int T>
5 class int_ {
6 };
8 template<int T, int T2>
9 class Unit {
10 public:
11     Unit(const Unit<T, T2>& other) {}
14 template<int T>
15 class Quan {
16 public:
17     Quan(void) {}
19     template<int T2>
20     Quan(double value, Unit<T, T2> unit) {}
22 typedef Quan<0> Scalar;
24 template<int T>
25 class hlp {
26 public:
27    typedef Quan<T> type;
30 class Mtrl {
31 public:
32     template<int T>
33     struct AssoType {
34         typedef typename hlp<T>::type type;
35     };
38 template<class T>
39 class Eval {
40 public:
41     Eval(const T& object){}
43     template<int V>
44     void eval() {
45         eval<V> (int_<0>());
46     }
47 private:
48     template<typename U> struct Wrap {};
50     template<int V, int V2>
51     void value(Wrap<Quan<V2> >) {}
53     template<int V>
54     void value(Wrap<Scalar>) {}
56     template<int V>
57     void eval(int_<0>) {
58         typedef typename T::template AssoType<V>::type Type;
59         value<V>(Wrap<Type>());
60     }
63 class Foo {
64 public:
65     static void eval(const Mtrl& mtrl) {
66         Eval<Mtrl> h(mtrl);
67         h.eval<0> ();
68     }