Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2008-11-27 15:02:55 +0300
committerMarek Safar <marek.safar@gmail.com>2008-11-27 15:02:55 +0300
commit2ba417e96103f1ab29e39b7c25372cdc127fd4c1 (patch)
tree7d1bd9f2f8484dcde3d786e7e4f065aecfc1b467 /mcs/tests/gtest-428.cs
parentd7cb70d48f8b0c6f906032ee9c7d75d75a8514cb (diff)
New test.
svn path=/trunk/mcs/; revision=120140
Diffstat (limited to 'mcs/tests/gtest-428.cs')
-rw-r--r--mcs/tests/gtest-428.cs64
1 files changed, 64 insertions, 0 deletions
diff --git a/mcs/tests/gtest-428.cs b/mcs/tests/gtest-428.cs
new file mode 100644
index 00000000000..33e76fcd022
--- /dev/null
+++ b/mcs/tests/gtest-428.cs
@@ -0,0 +1,64 @@
+using System;
+
+public struct CInt
+{
+ int data;
+
+ public CInt (int data)
+ {
+ this.data = data;
+ }
+
+ public static implicit operator CInt (int xx)
+ {
+ return new CInt (xx);
+ }
+
+ public static implicit operator int (CInt xx)
+ {
+ return xx.data;
+ }
+}
+
+
+public class Klass
+{
+ CInt? t;
+ public Klass (CInt? t)
+ {
+ this.t = t;
+ }
+
+ public CInt? Value
+ {
+ get
+ {
+ return t;
+ }
+ }
+}
+
+public class MainClass
+{
+ public static int Main ()
+ {
+ var v = new Klass (new CInt (3));
+
+ if (v.Value == 1)
+ return 1;
+
+ if (v.Value != 3)
+ return 2;
+
+ if (v.Value == null)
+ return 3;
+
+ var v2 = new Klass (null);
+
+ if (v2.Value != null)
+ return 4;
+
+ Console.WriteLine ("OK");
+ return 0;
+ }
+}