[Mono.Unix] Fix crasher in StringToHeap (#5639)
[mono.git] / mcs / tests / gtest-lambda-25.cs
1 using System;
2
3 namespace MonoBugs
4 {
5         public struct Foo<T>
6         {
7                 public T Item;
8         }
9
10         public static class Bar
11         {
12                 public static void DoStuff<T> (T item, Action<T> fn)
13                 {
14                         throw new ApplicationException ("failed");
15                 }
16
17                 public static void DoStuff<T> (T? item, Action<T> fn)
18                         where T : struct
19                 {
20                         fn (item.Value);
21                 }
22         }
23
24         public static class Program
25         {
26                 public static void Main ()
27                 {
28                         Foo<int>? value = new Foo<int> { Item = 3 };
29                         Bar.DoStuff (value, x => Console.WriteLine (x.Item));
30                 }
31         }
32 }