1 // Compiler options: -unsafe
4 using System.Runtime.InteropServices;
10 [StructLayout (LayoutKind.Sequential)]
11 public struct T { int x; }
15 [StructLayout (LayoutKind.Sequential)]
16 struct S { int x; int y; }
23 if (typeof (S *).GetElementType () != typeof (A.B.S))
24 error += " composed cast (pointer),";
26 if (sizeof (S) != sizeof (A.B.S))
29 S *p1 = stackalloc S [1];
31 if ((*p1).GetType () != typeof (A.B.S))
32 error += " local declaration, 'stackalloc' keyword,";
35 if ((*p2).GetType () != typeof (A.B.S))
36 error += " class declaration, 'fixed' statement,";
40 if (error.Length != 0)
41 throw new Exception ("The following couldn't resolve S as A+B+S:" + error);
45 public static void Main()