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>2017-12-22 02:49:48 +0300
committerBernhard Urban <bernhard.urban@xamarin.com>2017-12-22 17:31:45 +0300
commit6e885dec43b2e275822e9372412a7077287fd484 (patch)
tree8d7e7917ca6a65dc6d674d40d320aba8a51344e8 /mcs/tests/gtest-647.cs
parent492f66c60f7ca3bb7b88b231e2d8f42f8347f1ee (diff)
[mcs] Support implicit user conversion from nullable type without unwrapping. Fixes #60900
Diffstat (limited to 'mcs/tests/gtest-647.cs')
-rw-r--r--mcs/tests/gtest-647.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/mcs/tests/gtest-647.cs b/mcs/tests/gtest-647.cs
new file mode 100644
index 00000000000..4aae641f85f
--- /dev/null
+++ b/mcs/tests/gtest-647.cs
@@ -0,0 +1,34 @@
+using System;
+
+public class Program
+{
+ public static int Main ()
+ {
+ int B = default (MyStruct?);
+ if (MyStruct.counter != 1)
+ return 1;
+
+ switch (default (MyStruct?)) {
+ case 0:
+ break;
+ default:
+ return 2;
+ }
+
+ if (MyStruct.counter != 2)
+ return 4;
+
+ return 0;
+ }
+
+ public struct MyStruct
+ {
+ public static int counter;
+
+ public static implicit operator int (MyStruct? s)
+ {
+ ++counter;
+ return 0;
+ }
+ }
+} \ No newline at end of file