Merge pull request #4998 from kumpera/fix_56684
[mono.git] / mono / tests / bug-685908.cs
1
2 using System;
3 using System.Linq;
4 using System.Linq.Expressions;
5
6 class Program
7 {
8         static int Main ()
9         {
10                 if (Test<S> () == 5)
11                         return 0;
12                 return 1;
13         }
14
15         static int Test<T> () where T : I
16         {
17                 Expression<Func<T, int>> e = l => l.SetValue () + l.Value;
18                 var arg = default (T);
19                 return (int) (e.Compile () (arg));
20         }
21 }
22
23 interface I
24 {
25         int Value { get; }
26         int SetValue ();
27 }
28
29 struct S : I
30 {
31         int value;
32
33         public int Value {
34                 get {
35                         return value;
36                 }
37         }
38
39         public int SetValue ()
40         {
41                 value = 5;
42                 return 0;
43         }
44 }