2009-10-22 Marek Safar <marek.safar@gmail.com>
[mcs.git] / errors / cs0121-5.cs
blob77187f766645b0b8dad7c65182feb435bb1c83a3
1 // CS0121: The call is ambiguous between the following methods or properties: `V3.operator -(V3, V3)' and `V2.operator -(V2, V2)'
2 // Line: 45
4 public struct V3
6 public float x, y, z;
8 public V3 (float ix, float iy, float iz) { x = ix; y = iy; z = iz; }
10 static public V3 operator - (V3 lhs, V3 rhs)
12 return new V3 (lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);
16 public struct V2
18 public float x, y;
20 public V2 (float ix, float iy) { x = ix; y = iy; }
22 public static implicit operator V2 (V3 v)
24 return new V2 (v.x, v.y);
27 public static implicit operator V3 (V2 v)
29 return new V3 (v.x, v.y, 0);
32 static public V2 operator - (V2 lhs, V2 rhs)
34 return new V2 (lhs.x - rhs.x, lhs.y - rhs.y);
38 internal class Test
40 static void Main ()
42 V2 a = new V2 ();
43 V3 b = new V3 ();
45 V2 s = a - b;