From 84e9a10987fa04bd2c3b7e81d27888a6b9096e6a Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Mon, 27 Feb 2017 17:55:53 +0100 Subject: [objects.cs] testcase for delegate with instance method that uses `this' --- mono/mini/objects.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs index 3aa8a24aaf4..9cbbcd28f54 100644 --- a/mono/mini/objects.cs +++ b/mono/mini/objects.cs @@ -876,6 +876,23 @@ class Tests { return 2; } + class InstanceDelegateTest { + public int a; + + public int return_field () { + return a; + } + } + + public static int test_2_instance_delegate_with_field () { + InstanceDelegateTest t = new InstanceDelegateTest () { a = 1337 }; + GetIntDel del = new GetIntDel (t.return_field); + int v = del (); + if (v != 1337) + return 0; + return 2; + } + interface IFaceVirtualDel { int return_field (); } -- cgit v1.2.3