Test for bug #80235.
authorPaolo Molaro <lupus@oddwiz.org>
Tue, 12 Dec 2006 16:03:12 +0000 (16:03 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Tue, 12 Dec 2006 16:03:12 +0000 (16:03 -0000)
svn path=/trunk/mono/; revision=69405

mono/tests/Makefile.am
mono/tests/test-dup-mp.cs [new file with mode: 0644]

index c93a81e1259c837f623941c875b296a5c1fdca15..877f9139d8dad669984a5b05fbb73a2b9cccce37 100644 (file)
@@ -49,6 +49,7 @@ TEST_CS_SRC=                  \
        hash-table.cs           \
        test-ops.cs             \
        obj.cs                  \
+       test-dup-mp.cs          \
        string.cs               \
        stringbuilder.cs        \
        switch.cs               \
diff --git a/mono/tests/test-dup-mp.cs b/mono/tests/test-dup-mp.cs
new file mode 100644 (file)
index 0000000..2a0ffeb
--- /dev/null
@@ -0,0 +1,58 @@
+/* This class works fine */
+public class Works {
+
+    private double val;
+
+    public double this[int i, int j] {
+
+        get { return val; }
+
+        set { val = value; }
+
+    }
+
+    public Works(double val)
+    { this.val = val; }
+
+}
+
+/* Same code as struct breaks */
+
+public struct Breaks {
+
+    private double val;
+
+    public double this[int i, int j] {
+
+        get { return val; }
+
+        set { val = value; }
+
+    }
+
+    public Breaks(double val)
+    { this.val = val; }
+
+}
+
+public class Tester {
+
+    public static void Main(string[] args)
+
+    {
+
+        System.Console.WriteLine("This works");
+
+        Works w = new Works(3.0);
+
+        w[0, 0] += 3.0;
+
+        System.Console.WriteLine("This breaks");
+
+        Breaks b = new Breaks(3.0);
+
+        b[0, 0] += 3.0;
+
+    }
+
+}