Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

45 lines
517 B
C#

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;
}
}