[jit] Fix the handling of virtual generic methods on interfaces in the delegate virtu...
authorZoltan Varga <vargaz@gmail.com>
Wed, 6 Jan 2016 08:59:01 +0000 (03:59 -0500)
committerZoltan Varga <vargaz@gmail.com>
Wed, 6 Jan 2016 08:59:06 +0000 (03:59 -0500)
mono/mini/mini-runtime.c
mono/mini/objects.cs

index 9f62e40fd0dcc5ae65759afac63d8547c34ca03b..2f61cb17e9fa8256dea9c170444799fc42150759 100644 (file)
@@ -2993,7 +2993,7 @@ mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *met
        is_interface = method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ? TRUE : FALSE;
        load_imt_reg = is_virtual_generic || is_interface;
 
-       if (is_interface && !is_virtual_generic)
+       if (is_interface)
                offset = ((gint32)mono_method_get_imt_slot (method) - MONO_IMT_SIZE) * SIZEOF_VOID_P;
        else
                offset = G_STRUCT_OFFSET (MonoVTable, vtable) + ((mono_method_get_vtable_index (method)) * (SIZEOF_VOID_P));
index 2fe402f907f016291577350c5d7291ed91394daa..c6837933d3f5203420b50c086c7645ae8cbd1a85 100644 (file)
@@ -1708,6 +1708,25 @@ ncells ) {
        public static int test_42_pass_16byte_struct_split () {
                return pass_struct16 (null, null, null, null, null, new Struct16 () { a = 42 });
        }
+
+       public interface IComparer2
+       {
+               Type foo<T> ();
+       }
+
+       public class AClass : IComparer2 {
+               public Type foo<T> () {
+                       return typeof(T);
+               }
+       }
+
+       public static int test_0_delegate_to_virtual_generic_on_ifaces () {
+               IComparer2 c = new AClass ();
+
+               Func<Type> f = c.foo<string>;
+               return f () == typeof(string) ? 0 : 1;
+       }
+
 }
 
 #if __MOBILE__