diff options
author | Marek Safar <marek.safar@gmail.com> | 2010-10-11 20:24:24 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2010-10-11 20:25:51 +0400 |
commit | 6cb9d0059108a869cc9bfade2703a0104e68894c (patch) | |
tree | 29bebb40b0eac3767f09a95f866b4625b67a94ec /mcs/tests/test-580.cs | |
parent | e98d5e33453448134f34f5d85c9e9a470a6bf007 (diff) |
Compound assignments over reference type array cannot use ldelema
Diffstat (limited to 'mcs/tests/test-580.cs')
-rw-r--r-- | mcs/tests/test-580.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mcs/tests/test-580.cs b/mcs/tests/test-580.cs index e0c7dba68ad..e1712837a7d 100644 --- a/mcs/tests/test-580.cs +++ b/mcs/tests/test-580.cs @@ -55,6 +55,35 @@ public class Bla { label[idx++, idx - 1] += s + s + s + s; } + static bool Test_Object () + { + int a = 0; + object[] o_a = new string[] { "A" }; + o_a [a++] += "Z"; + if ((string) o_a [0] != "AZ") + return false; + + a = 0; + object[,] o_a2 = new string[,] { { "X" } }; + o_a2[a++, 0] += "Z"; + if ((string) o_a2 [0, 0] != "XZ") + return false; + + return true; + } + + static bool Test_Decimal () + { + decimal[,] da = new decimal[,] { { 5, 6 } }; + da[0,0] = 6.7m; + da[0,0] += 1.2m; + + if (da [0,0] != 7.9m) + return false; + + return true; + } + public static int Main () { String str = "test"; @@ -97,6 +126,12 @@ public class Bla { if (sa2 [0,0] != "aaaa") return 7; + if (!Test_Object ()) + return 8; + + if (!Test_Decimal ()) + return 9; + return 0; } } |