Bump external/ikdasm to master.
[mono-project.git] / mono / tests / generic-initobj.2.cs
blob68ce22b7d09a44fd5fdeaa5bbc52adec39fad024
1 using System.Collections.Generic;
3 public class ClassA {};
4 public class ClassB {};
6 public struct GenStruct<T> {
7 public int field1;
8 public T field2;
9 public byte field3;
10 public long field4;
13 public class Gen<T> {
14 public static T getDefault () {
15 return default (T);
18 public static GenStruct<T> getDefaultStruct () {
19 return default (GenStruct<T>);
23 public class main {
24 public static bool isDefaultStruct<T> (GenStruct<T> gs) {
25 EqualityComparer<T> eq = EqualityComparer<T>.Default;
27 return gs.field1 == 0 && eq.Equals (gs.field2, default (T)) && gs.field3 == 0 && gs.field4 == 0;
30 public static int Main () {
31 if (Gen<ClassA>.getDefault () != null)
32 return 1;
33 if (Gen<ClassB>.getDefault () != null)
34 return 1;
35 if (Gen<int>.getDefault () != 0)
36 return 1;
37 if (!isDefaultStruct<ClassA> (Gen<ClassA>.getDefaultStruct ()))
38 return 1;
39 if (!isDefaultStruct<ClassB> (Gen<ClassB>.getDefaultStruct ()))
40 return 1;
41 if (!isDefaultStruct<int> (Gen<int>.getDefaultStruct ()))
42 return 1;
43 return 0;