diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs new file mode 100644 index 000000000..dc9f60013 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Attributes.StructLayout/ExplicitClass.cs @@ -0,0 +1,28 @@ +using System; +using System.Runtime.InteropServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Attributes.StructLayout { + [StructLayout (LayoutKind.Explicit)] + [KeptMember (".ctor()")] + class ExplicitClassData { + [FieldOffset (0)] + [Kept] // the linker could remove this + public int never_used; + [FieldOffset (4)] + [Kept] + public int used; + [FieldOffset (8)] + [Kept] + public int never_ever_used; + } + + public class ExplicitClass + { + public static void Main () + { + var c = new ExplicitClassData (); + c.used = 1; + } + } +} |