diff options
author | Marek Safar <marek.safar@gmail.com> | 2013-06-25 14:35:45 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2013-06-25 14:38:05 +0400 |
commit | 09ca788b4b0c7c1fc3e84cf96dda1440001a79c3 (patch) | |
tree | d3380c17369a295368f5d188314cb79a5fa1f9e4 /mcs/tests/gtest-587.cs | |
parent | 4c93595171a30353b167a4c9e6b9ba740b851a65 (diff) |
Rewrite lifted binary operators to match C# spec more closely. Fixes #12608 and about 10 other issues.
Diffstat (limited to 'mcs/tests/gtest-587.cs')
-rw-r--r-- | mcs/tests/gtest-587.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/mcs/tests/gtest-587.cs b/mcs/tests/gtest-587.cs new file mode 100644 index 00000000000..60484bdec39 --- /dev/null +++ b/mcs/tests/gtest-587.cs @@ -0,0 +1,51 @@ +using System; + +struct S +{ + public static implicit operator string (S s) + { + return "1"; + } + + public static implicit operator short? (S s) + { + return 1; + } + + public static implicit operator E (S s) + { + return 0; + } +} + +public enum E +{ +} + +class C +{ + public static int Main () + { + E? e = 0; + const E e1 = (E)44; + var res = e == e1; + if (res != false) + return 1; + + res = e1 == e; + if (res != false) + return 2; + + E e2 = 0; + S s; + var res2 = e2 & s; + if (res2 != 0) + return 3; + + res2 = s & e2; + if (res2 != 0) + return 4; + + return 0; + } +}
\ No newline at end of file |