From 6e885dec43b2e275822e9372412a7077287fd484 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 22 Dec 2017 00:49:48 +0100 Subject: [mcs] Support implicit user conversion from nullable type without unwrapping. Fixes #60900 --- mcs/tests/gtest-647.cs | 34 ++++++++++++++++++++++++++++++++++ mcs/tests/ver-il-net_4_x.xml | 19 +++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 mcs/tests/gtest-647.cs (limited to 'mcs/tests') 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 diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index e4156fbdb05..d57416d8e0b 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -11064,7 +11064,7 @@ - 72 + 60 62 @@ -19508,7 +19508,7 @@ - 267 + 255 7 @@ -20147,6 +20147,21 @@ + + + + 99 + + + 7 + + + + + 22 + + + -- cgit v1.2.3