1 // Compiler options: -unsafe
4 using System
.Runtime
.InteropServices
;
8 [StructLayout (LayoutKind
.Sequential
)]
13 [StructLayout (LayoutKind
.Sequential
)]
14 struct S { int x; int y; }
21 if (typeof (S
*).GetElementType () != typeof (A
.B
.S
))
22 error
+= " composed cast (pointer),";
24 if (sizeof (S
) != sizeof (A
.B
.S
))
27 S
*p1
= stackalloc S
[1];
29 if ((*p1
).GetType () != typeof (A
.B
.S
))
30 error
+= " local declaration, 'stackalloc' keyword,";
33 if ((*p2
).GetType () != typeof (A
.B
.S
))
34 error
+= " class declaration, 'fixed' statement,";
38 if (error
.Length
!= 0)
39 throw new Exception ("The following couldn't resolve S as A+B+S:" + error
);
43 public static void Main()