1 // Compiler options: -unsafe -r:gtest-fixedbuffer-01-lib.dll
6 using System.Runtime.InteropServices;
8 [module: DefaultCharSet (CharSet.Ansi)]
10 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
11 public unsafe struct TestNew {
12 private fixed char test_1 [128];
13 public fixed bool test2 [4];
15 public fixed int T [2];
16 public fixed bool test20 [4], test21 [40];
18 private int foo, foo2;
19 public void SetTest () {
20 fixed (char* c = test_1) {
27 public unsafe fixed byte Pad[64];
31 unsafe static int Test () {
32 TestNew tt = new TestNew ();
39 ExternalStruct es = new ExternalStruct ();
40 es.double_buffer [1] = 999999.8888;
41 es.double_buffer [0] = es.double_buffer [1];
44 if (Attribute.GetCustomAttribute (typeof (TestNew).GetField ("test2"), typeof (System.Runtime.CompilerServices.FixedBufferAttribute)) == null)
48 if (typeof (TestNew).GetNestedTypes ().Length != 5)
51 foreach (Type t in typeof (TestNew).GetNestedTypes ()) {
52 if (Attribute.GetCustomAttribute (t, typeof (System.Runtime.CompilerServices.CompilerGeneratedAttribute)) == null)
55 if (Attribute.GetCustomAttribute (t, typeof (System.Runtime.CompilerServices.UnsafeValueTypeAttribute)) == null)
58 if (!t.IsUnicodeClass)
62 Console.WriteLine ("OK");
66 public static int Main () {