[netcore] Implement/fix enum/nullable comparers.
[mono-project.git] / mono / tests / roslyn-bug-19038.cs
blob5a4a83a3cd44fb346f59082c7ca3175ee504281d
1 using System;
2 using System.Reflection;
4 unsafe public class C {
5 public int Value;
7 static void Main()
9 C a = new C { Value = 12 };
10 FieldInfo info = typeof(C).GetField("Value");
11 TypedReference reference = __makeref(a);
13 if (!(reference is TypedReference reference0))
14 throw new Exception("TypedReference");
16 info.SetValueDirect(reference0, 34);
18 Console.WriteLine($"a.Value = {a.Value}");
19 if (a.Value != 34)
20 throw new Exception("SetValueDirect");
22 int z = 56;
23 if (CopyRefInt(ref z) != 56)
24 throw new Exception("ref z");
26 Console.WriteLine("ok");
29 static int CopyRefInt(ref int z)
31 if (!(z is int z0))
32 throw new Exception("CopyRefInt");
33 return z0;