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:
authorMiguel de Icaza <miguel@gnome.org>2004-12-02 01:09:23 +0300
committerMiguel de Icaza <miguel@gnome.org>2004-12-02 01:09:23 +0300
commitf6b1af000785e5c751e9eac80d0c0f917e0e596d (patch)
tree2a7881f66b9734511cb425ba4537232b7f184ba6 /mcs/tests/test-322.cs
parentd8fa06570a6e17a0052655d5eb15a9f0f3e5dfd6 (diff)
New test for bug 62054
svn path=/trunk/mcs/; revision=36914
Diffstat (limited to 'mcs/tests/test-322.cs')
-rwxr-xr-xmcs/tests/test-322.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/mcs/tests/test-322.cs b/mcs/tests/test-322.cs
new file mode 100755
index 00000000000..47b4aebddc6
--- /dev/null
+++ b/mcs/tests/test-322.cs
@@ -0,0 +1,36 @@
+//
+// User casts basically would produce more than one match on
+// integral types, since the implicit conversion to int is
+// also an implicit conversion to long. This tests that
+// we do not bail too early on the switch statement with its
+// implicit conversion.
+
+class Y {
+ byte b;
+
+ public static implicit operator int (Y i)
+ {
+ return i.b;
+ }
+
+ public Y (byte b)
+ {
+ this.b = b;
+ }
+}
+
+class X {
+ static void Main ()
+ {
+ Y y = new Y (1);
+
+ switch (y){
+ case 0:
+ break;
+ case 1:
+ break;
+ }
+
+ int a = y;
+ }
+}