Add regression test.
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 7 Apr 2011 20:00:18 +0000 (17:00 -0300)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 7 Apr 2011 21:23:38 +0000 (18:23 -0300)
mono/tests/Makefile.am
mono/tests/bug-685908.cs [new file with mode: 0644]

index 0f119f1350245b66de966431aedef67d1f1a65d2..a423d3b67cfd80dfcf6331db4338c3627d88de68 100644 (file)
@@ -372,7 +372,8 @@ BASE_TEST_CS_SRC=           \
        bug-389886-3.cs \
        monitor.cs      \
        dynamic-method-resurrection.cs  \
-       bug-666008.cs   
+       bug-666008.cs   \
+       bug-685908.cs
 
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
diff --git a/mono/tests/bug-685908.cs b/mono/tests/bug-685908.cs
new file mode 100644 (file)
index 0000000..32a9faa
--- /dev/null
@@ -0,0 +1,44 @@
+
+using System;
+using System.Linq;
+using System.Linq.Expressions;
+
+class Program
+{
+       static int Main ()
+       {
+               if (Test<S> () == 5)
+                       return 0;
+               return 1;
+       }
+
+       static int Test<T> () where T : I
+       {
+               Expression<Func<T, int>> e = l => l.SetValue () + l.Value;
+               var arg = default (T);
+               return (int) (e.Compile () (arg));
+       }
+}
+
+interface I
+{
+       int Value { get; }
+       int SetValue ();
+}
+
+struct S : I
+{
+       int value;
+
+       public int Value {
+               get {
+                       return value;
+               }
+       }
+
+       public int SetValue ()
+       {
+               value = 5;
+               return 0;
+       }
+}