Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-630.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4ac6173091e92495bfa79498d8af4eeb1e2c50c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;

public class MyEx : Exception {
	public MyEx () {}
}

public class Ex {

	public static int test (int a) {
		int res;
		int fin = 0;
		try {
			res = 10/a;
			throw new MyEx ();
		} catch (Exception ex) {
			ex = new MyEx ();
			throw;
		} finally {
			fin = 1;
		}
		return res;
	}
	public static int Main () {
		int catched = 0;
		try {
			test (1);
		} catch (MyEx ex) {
			catched = 1;
		}
		if (catched != 1)
			return 2;
		try {
			test (0);
		} catch (MyEx ex) {
			catched = 2;
		} catch {
			// we should get here because rethrow rethrows the dividebyzero ex
			// not the exception assigned to the local var (a MyEx)
			catched = 3;
		}
		if (catched != 3)
			return 3;
		return 0;
	}
}