d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail12809.d
blob65e89b196c7e878a7d1530a8bdafb804b49e9af3
1 // REQUIRED_ARGS: -o-
3 bool cond;
5 /*
6 TEST_OUTPUT:
7 ---
8 fail_compilation/fail12809.d(18): Error: `object.Exception` is thrown but not caught
9 fail_compilation/fail12809.d(15): Error: function `fail12809.test_finally1` may throw but is marked as `nothrow`
10 fail_compilation/fail12809.d(34): Error: `object.Exception` is thrown but not caught
11 fail_compilation/fail12809.d(38): Error: `object.Exception` is thrown but not caught
12 fail_compilation/fail12809.d(31): Error: function `fail12809.test_finally3` may throw but is marked as `nothrow`
13 ---
15 void test_finally1() nothrow
17 try
18 throw new Exception(""); // error
19 finally
23 void test_finally2() nothrow
25 try
26 throw new Exception(""); // no error
27 finally
28 assert(0); // unconditional halt
31 void test_finally3() nothrow
33 try
34 throw new Exception(""); // error
35 finally
37 if (cond)
38 throw new Exception(""); // error
39 assert(0); // conditional halt
44 TEST_OUTPUT:
45 ---
46 fail_compilation/fail12809.d(58): Error: `object.Exception` is thrown but not caught
47 fail_compilation/fail12809.d(53): Error: function `fail12809.test_finally4` may throw but is marked as `nothrow`
48 fail_compilation/fail12809.d(74): Error: `object.Exception` is thrown but not caught
49 fail_compilation/fail12809.d(78): Error: `object.Exception` is thrown but not caught
50 fail_compilation/fail12809.d(69): Error: function `fail12809.test_finally6` may throw but is marked as `nothrow`
51 ---
53 void test_finally4() nothrow
55 try
57 finally
58 throw new Exception(""); // error
61 void test_finally5() nothrow
63 try
64 assert(0); // unconditional halt
65 finally
66 throw new Exception(""); // no error
69 void test_finally6() nothrow
71 try
73 if (cond)
74 throw new Exception(""); // error
75 assert(0); // conditional halt
77 finally
78 throw new Exception(""); // error