aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/koenig6.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/template/koenig6.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/template/koenig6.C29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/koenig6.C b/gcc-4.9/gcc/testsuite/g++.dg/template/koenig6.C
new file mode 100644
index 000000000..8f93a653a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/template/koenig6.C
@@ -0,0 +1,29 @@
+// 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;
+}