Welcome to mirror list, hosted at ThFree Co, Russian Federation.

UnusedFieldsOfStructsAreKept.cs « Basic « Mono.Linker.Tests.Cases « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ff4bb5ae92a87e46a13ec134118210a45c1beb7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Runtime.CompilerServices;
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Basic
{
	public class UnusedFieldsOfStructsAreKept
	{
		public static void Main ()
		{
			A a = new A ();
			PreventCompilerOptimization (a);
			R r = new R ();
		}

		[Kept]
		static void PreventCompilerOptimization (A a)
		{
		}

		[Kept]
		struct A
		{
			[Kept]
			private int UnusedField1;
			[Kept]
			private int UnusedField2;

			public void UnusedMethod ()
			{
			}
		}

		[KeptAttributeAttribute (typeof (IsByRefLikeAttribute))]
		[KeptAttributeAttribute (typeof (CompilerFeatureRequiredAttribute))]
		[KeptAttributeAttribute (typeof (ObsoleteAttribute))]
		ref struct R
		{
			[Kept]
			public ref int UnusedRefField;

			[Kept]
			int UnusedField;

			[Kept]
			int UsedField;
		}
	}
}