Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-499.cs
1 // Compiler options: -optimize
2
3 using System;
4 using System.Reflection;
5
6 public class C
7 {
8         public static int Test<T> (T[] t)
9         {
10                 // Has to include readonly. prefix
11                 return t[0].GetHashCode ();
12         }
13
14         public static int TestExtra<T> (T[,] t)
15         {
16                 // Has to include readonly. prefix
17                 return t[0, 0].GetHashCode ();
18         }
19
20         public static int Main ()
21         {
22                 Test (new[] { 2.1, 4.5 });
23                 Test (new[] { "b" });
24
25                 var body = typeof (C).GetMethod ("Test").GetMethodBody ();
26
27                 // Check for readonly. (0xFE1E)
28                 var array = body.GetILAsByteArray ();
29                 if (array[2] != 0xFE)
30                         return 1;
31
32                 if (array[3] != 0x1E)
33                         return 1;
34
35                 return 0;
36         }
37 }