Move Enum and CorElementType to shared (dotnet/coreclr#23177)
[mono-project.git] / mcs / tests / test-928.cs
blob290ee4d1fb3220513697625a67cf3a2e84bb1ef2
1 // Compiler options: -unsafe
3 using System;
4 using System.Reflection;
5 using System.Linq;
7 unsafe class Program
9 public static void Test ()
11 string s = "";
12 unsafe {
13 fixed (char *chars = s) {
18 public static bool StringNull (string s)
20 unsafe {
21 fixed (char *a = s) {
22 return a == null;
27 public static bool ArrayNull (int[] a)
29 unsafe {
30 fixed (int *e = a) {
31 return e == null;
36 public static int Main ()
38 Test ();
40 var m = typeof (Program).GetMethod ("Test");
41 var lv = m.GetMethodBody ().LocalVariables.Where (l => l.LocalType == typeof (char*)).Single ();
42 if (lv.IsPinned)
43 return 1;
45 if (!StringNull (null))
46 return 1;
48 if (!ArrayNull (null))
49 return 2;
51 return 0;