view gcc/testsuite/g++.dg/template/koenig6.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/38850

template <typename VType>
class Vector2 {
 private:
  VType c_[2];
 public:
  typedef Vector2<VType> Self;

  Vector2(const VType x, const VType y) {
    c_[0] = x;
    c_[1] = y;
  }

  friend inline Self Max(const Self &v1, const Self &v2) {
    return Self(v1.c_[0], v1.c_[1]);
  }
};

template <class T>
Vector2<float> foo(T x) {
  Vector2<float> y(0,0);
  return Max(y, y);
}

int main() {
  foo(3);
  return 0;
}