191e0a9412cc462483024b3fc91e1527527f4a2d
[mono.git] / mcs / tests / test-99.cs
1 //
2 // Tests the resulting value of operator + (U x, E y)
3 // as well as implicit conversions in the above operator.
4 //
5 using System;
6 class X {
7         enum A : int {
8                 a = 1, b, c
9         }
10         
11         enum Test : short {
12                 A = 1,
13                 B
14         }
15         
16         static int Main ()
17         {
18                 int v = 1;
19                 object foo = (v + A.a);
20                 object foo2 = (1 + A.a);
21
22                 if (foo.GetType ().ToString () != "X+A"){
23                         Console.WriteLine ("Expression evaluator bug in E operator + (U x, E y)");
24                         return 1;
25                 }
26                 
27                 if (foo2.GetType ().ToString () != "X+A"){
28                         Console.WriteLine ("Constant folder bug in E operator + (U x, E y)");
29                         return 2;
30                 }
31
32                 // Now try the implicit conversions for underlying types in enum operators
33                 byte b = 1;
34                 short s = (short) (Test.A + b);
35                 
36                 return 0;
37         }
38 }