Merge pull request #4938 from kumpera/optimize_ref_queries
[mono.git] / mono / tests / bug-78656.cs
1 delegate void voi ();
2
3 class BasicValueTypesTest
4 {
5         static int trycatch (voi f) {
6                 try {
7                         f ();
8                         return 1;
9                 }
10                 catch (System.OverflowException e) {
11                         System.Console.WriteLine (e);
12                         return 0;
13                 }
14         }
15
16
17         static void foo1 () {
18                 checked {
19                         long x = System.Int64.MinValue;
20                         long y =  x - 1L;
21                 }
22         }
23
24         static void foo2 () {
25                 checked {
26                         byte x = System.Byte.MaxValue;
27                         ++x;
28                 }
29         }
30
31         public static int Main () {
32                 int result = 0;
33                 
34                 result += trycatch (foo1);
35                 result += trycatch (foo2);
36                 
37                 return result;
38         }
39 }
40