X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fobjects.cs;h=21fd43e7d437f0ed5689d9d63c455e19add2be50;hb=222df67b5f5a9bd5e2c8da9e454b0f2883e1fe41;hp=c6837933d3f5203420b50c086c7645ae8cbd1a85;hpb=95f1d9f467300b11da5b2defcfaec2f234f4ec0e;p=mono.git diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs index c6837933d3f..21fd43e7d43 100644 --- a/mono/mini/objects.cs +++ b/mono/mini/objects.cs @@ -874,6 +874,49 @@ 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 (); + } + + struct VtypeVirtualDelStruct : IFaceVirtualDel { + public int f; + public int return_field_nonvirt () { + return f; + } + public int return_field () { + return f; + } + } + + public static int test_42_vtype_delegate () { + var s = new VtypeVirtualDelStruct () { f = 42 }; + Func f = s.return_field_nonvirt; + return f (); + } + + public static int test_42_vtype_virtual_delegate () { + IFaceVirtualDel s = new VtypeVirtualDelStruct () { f = 42 }; + Func f = s.return_field; + return f (); + } + public static int test_1_store_decimal () { decimal[,] a = {{1}}; @@ -1727,6 +1770,28 @@ ncells ) { return f () == typeof(string) ? 0 : 1; } + public enum ByteEnum2 : byte { + High = 142 + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static int enum_arg_zero_extend (ByteEnum2 b) { + return (int)b; + } + + public static int test_142_byte_enum_arg_zero_extend () { + return enum_arg_zero_extend (ByteEnum2.High); + } + + enum Mine { One, Two } + + public static int test_0_enum_gethashcode_opt () { + int sum = 0; + for (int i = 0; i < 1000000; ++i) + sum += Mine.Two.GetHashCode(); + + return 0; + } } #if __MOBILE__