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