1 // PR c++/38850 2 3 template <typename VType> 4 class Vector2 { 5 private: 6 VType c_[2]; 7 public: 8 typedef Vector2<VType> Self; 9 Vector2(const VType x,const VType y)10 Vector2(const VType x, const VType y) { 11 c_[0] = x; 12 c_[1] = y; 13 } 14 Max(const Self & v1,const Self & v2)15 friend inline Self Max(const Self &v1, const Self &v2) { 16 return Self(v1.c_[0], v1.c_[1]); 17 } 18 }; 19 20 template <class T> foo(T x)21Vector2<float> foo(T x) { 22 Vector2<float> y(0,0); 23 return Max(y, y); 24 } 25 main()26int main() { 27 foo(3); 28 return 0; 29 } 30