cleol
[mcs.git] / tests / test-223.cs
blobe9d424d40a464334680cbd5aab6429676d9ff487
1 //
2 // This tests that conversions from Enum and ValueType to structs
3 // are treated as unboxing conversions, and the `unbox' opcode
4 // is emitted. #52569.
5 //
7 enum Foo { Bar }
8 class T {
9 static int Main ()
11 System.Enum e = Foo.Bar;
12 System.ValueType vt1 = Foo.Bar, vt2 = 1;
14 if (((Foo) e) != Foo.Bar)
15 return 1;
17 if (((Foo) vt1) != Foo.Bar)
18 return 2;
20 if (((int) vt2) != 1)
21 return 3;
24 // Test that we can assign null to a valueType
27 System.ValueType vt = null;
29 return 0;