[mcs] Add codegen for null operator on result of awaited instance expression of prope...
[mono.git] / mcs / tests / gtest-180.cs
1 using System;
2 using System.Runtime.InteropServices;
3
4 [module: DefaultCharSet (CharSet.Unicode)]
5
6 struct foo1
7 {
8 }
9
10 enum E
11 {
12 }
13
14 [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)]
15 struct foo2
16 {
17 }
18
19 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
20 delegate void D ();
21
22 class C
23 {
24         public class CC
25         {
26         }
27 }
28
29 class Program
30 {
31
32         [DllImport ("bah")]
33         public static extern void test ();
34
35         public static int Main ()
36         {
37                 DllImportAttribute dia = Attribute.GetCustomAttribute (typeof (Program).GetMethod ("test"), typeof (DllImportAttribute)) as DllImportAttribute;
38                 if (dia == null)
39                         return 1;
40
41                 if (dia.CharSet != CharSet.Unicode)
42                         return 2;
43
44                 if (!typeof (C).IsUnicodeClass)
45                         return 3;
46
47                 if (!typeof (C.CC).IsUnicodeClass)
48                         return 4;
49
50                 if (!typeof (D).IsUnicodeClass)
51                         return 5;
52
53                 var ufp = typeof (D).GetCustomAttributes (false)[0] as UnmanagedFunctionPointerAttribute;
54                 if (ufp.CharSet != CharSet.Unicode)
55                         return 51;
56
57                 if (!typeof (E).IsUnicodeClass)
58                         return 6;
59
60                 if (!typeof (foo1).IsUnicodeClass)
61                         return 7;
62
63                 if (!typeof (foo2).IsAutoClass)
64                         return 8;
65
66                 return 0;
67         }
68 }