diff options
author | Marek Safar <marek.safar@gmail.com> | 2014-07-02 17:32:20 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2014-07-02 17:33:04 +0400 |
commit | f2c645206bc14cd75712654c177ad5ab165044e7 (patch) | |
tree | a78ed1060b0a845849873817911ea4fea1746607 /mcs/tests/gtest-618.cs | |
parent | bde70c695468c5a83fb49c3b61e4be2266aa96c7 (diff) |
[mcs] Add new test
Diffstat (limited to 'mcs/tests/gtest-618.cs')
-rw-r--r-- | mcs/tests/gtest-618.cs | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/mcs/tests/gtest-618.cs b/mcs/tests/gtest-618.cs new file mode 100644 index 00000000000..d92fa12d18a --- /dev/null +++ b/mcs/tests/gtest-618.cs @@ -0,0 +1,73 @@ +using System; + +struct S1 +{ + public static implicit operator int (S1? s) + { + return 1; + } +} + +struct S2 +{ + public static implicit operator int? (S2? s) + { + return null; + } +} + +struct S3 +{ + public static implicit operator int? (S3? s) + { + return 2; + } +} + +struct S4 +{ + public static implicit operator int? (S4 s) + { + return 3; + } +} + +class C +{ + public static int Main () + { + S1? s1 = new S1 (); + switch (s1) { + case 1: + break; + default: + return 1; + } + + S2? s2 = new S2 (); + switch (s2) { + case null: + break; + default: + return 2; + } + + S3? s3 = new S3 (); + switch (s3) { + case 2: + break; + default: + return 3; + } + + S4 s4 = new S4 (); + switch (s4) { + case 3: + break; + default: + return 4; + } + + return 0; + } +}
\ No newline at end of file |