Debian Codegraph @

gcc/testsuite/g++.dg/template/koenig6.C

raw
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
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
20 template <class T>
21 Vector2<float> foo(T x) {
22 Vector2<float> y(0,0);
23 return Max(y, y);
24 }
25
26 int main() {
27 foo(3);
28 return 0;
29 }