1// Origin: PR c++/42824 2// { dg-do compile } 3 4template<int T> 5class int_ { 6}; 7 8template<int T, int T2> 9class Unit { 10public: 11 Unit(const Unit<T, T2>& other) {} 12}; 13 14template<int T> 15class Quan { 16public: 17 Quan(void) {} 18 19 template<int T2> 20 Quan(double value, Unit<T, T2> unit) {} 21}; 22typedef Quan<0> Scalar; 23 24template<int T> 25class hlp { 26public: 27 typedef Quan<T> type; 28}; 29 30class Mtrl { 31public: 32 template<int T> 33 struct AssoType { 34 typedef typename hlp<T>::type type; 35 }; 36}; 37 38template<class T> 39class Eval { 40public: 41 Eval(const T& object){} 42 43 template<int V> 44 void eval() { 45 eval<V> (int_<0>()); 46 } 47private: 48 template<typename U> struct Wrap {}; 49 50 template<int V, int V2> 51 void value(Wrap<Quan<V2> >) {} 52 53 template<int V> 54 void value(Wrap<Scalar>) {} 55 56 template<int V> 57 void eval(int_<0>) { 58 typedef typename T::template AssoType<V>::type Type; 59 value<V>(Wrap<Type>()); 60 } 61}; 62 63class Foo { 64public: 65 static void eval(const Mtrl& mtrl) { 66 Eval<Mtrl> h(mtrl); 67 h.eval<0> (); 68 } 69}; 70 71