dlr bug
[mcs.git] / tests / test-349.cs
blob040c6c3e87f5c5fc06f0a0dce015219fd55d1d91
1 // Compiler options: -optimize+
3 using System;
4 using System.Reflection;
6 enum E
10 delegate void D();
12 class C {
13 public C () {}
15 int i = new int ();
16 int i2 = 1 - 1;
17 double d = new double ();
18 char c = new char ();
19 bool b = new bool ();
20 decimal dec2 = new decimal ();
21 object o = null;
22 ValueType BoolVal = (ValueType)null;
23 E e = new E ();
24 event D Ev1 = null;
26 int[] a_i = null;
27 object[] a_o = null;
28 ValueType[] a_v = null;
31 class X
33 public static event D Ev1 = null;
34 public static event D Ev2 = null;
35 protected static string temp = null, real_temp = null;
38 class X2
40 static int i = 5;
44 class Test
46 static int a = b = 5;
47 static int b = 0;
49 static int Main ()
51 if (a != 5 || b != 0)
52 return 1;
54 if ((typeof (X2).Attributes & TypeAttributes.BeforeFieldInit) == 0)
55 return 2;
57 #if NET_2_0
58 ConstructorInfo mi = typeof(C).GetConstructors ()[0];
59 MethodBody mb = mi.GetMethodBody();
61 if (mb.GetILAsByteArray ().Length != 7) {
62 Console.WriteLine("Optimization failed");
63 return 3;
65 #endif
67 Console.WriteLine ("OK");
68 return 0;