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>2014-05-22 10:37:14 +0400
committerMarek Safar <marek.safar@gmail.com>2014-05-22 10:38:42 +0400
commitc9f4ae33e0197e209b30f126e648e1bda15150ae (patch)
treebcc5d247943229ba6196d0ddd33f8be61576a9cc /mcs/tests/gtest-612.cs
parent02d6d971f3a155d2a5f569fbf980be33c7376287 (diff)
[mcs] Emit better code for null coalescing operator with nullable return type. Fixes #19702
Diffstat (limited to 'mcs/tests/gtest-612.cs')
-rw-r--r--mcs/tests/gtest-612.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/mcs/tests/gtest-612.cs b/mcs/tests/gtest-612.cs
new file mode 100644
index 00000000000..dac47d12e3f
--- /dev/null
+++ b/mcs/tests/gtest-612.cs
@@ -0,0 +1,34 @@
+using System;
+
+class MainClass
+{
+ static byte count;
+
+ public static int Main ()
+ {
+ var x = Left () ?? Right();
+ if (count != 1)
+ return 1;
+
+ switch (Left ()) {
+ case 0:
+ return 2;
+ }
+
+ if (count != 2)
+ return 3;
+
+ Console.WriteLine ("ok");
+ return 0;
+ }
+
+ static int? Left()
+ {
+ return ++count;
+ }
+
+ static int? Right ()
+ {
+ return 0;
+ }
+} \ No newline at end of file