[tuner] handle the case with multiple "preserve" attributes
[mono-project.git] / mcs / tests / test-named-04.cs
blobf5070ce1660484148bec6cb05026637ae73a8475
1 using System;
3 struct S
5 public int Foo;
8 class Program
10 static void Foo2 (int a, ref int b)
12 Console.WriteLine (a);
13 Console.WriteLine (b);
15 if (a != 0 || b != 0)
16 throw new ApplicationException ();
18 b = 500;
21 static void Test<T> (T[] t)
23 Foo (b: ref t[1], a: t[0]);
26 static void Foo<T> (T a, ref T b)
28 b = a;
31 public static int Main ()
33 var a = new S [] { new S (), new S (), new S () };
34 int i = 1;
35 Foo2 (b: ref a[i].Foo, a: a[++i].Foo++);
37 Console.WriteLine (a[0].Foo);
38 Console.WriteLine (a[1].Foo);
39 Console.WriteLine (a[2].Foo);
41 if (a [0].Foo != 0)
42 return 1;
44 if (a [1].Foo != 500)
45 return 2;
47 if (a [2].Foo != 1)
48 return 3;
50 var array = new [] { 3, 4 };
51 Test<int>(array);
52 if (array [1] != 3)
53 return 4;
55 return 0;