MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail2456.d
blob5d7d6eebd2e56614f74e4c8676747f6d18a80510
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail2456.d(14): Error: cannot put `scope(success)` statement inside `finally` block
5 ---
6 */
7 void test_success()
9 try
12 finally
14 scope(success) {} // NG
19 TEST_OUTPUT:
20 ---
21 fail_compilation/fail2456.d(31): Error: cannot put `scope(failure)` statement inside `finally` block
22 ---
24 void test_failure()
26 try
29 finally
31 scope(failure) {} // NG
36 TEST_OUTPUT:
37 ---
38 ---
40 void test_exit()
42 try
45 finally
47 scope(exit) {} // OK
52 TEST_OUTPUT:
53 ---
54 fail_compilation/fail2456.d(64): Error: cannot put `scope(success)` statement inside `scope(success)`
55 fail_compilation/fail2456.d(65): Error: cannot put `scope(failure)` statement inside `scope(success)`
56 fail_compilation/fail2456.d(78): Error: cannot put `scope(success)` statement inside `scope(exit)`
57 fail_compilation/fail2456.d(79): Error: cannot put `scope(failure)` statement inside `scope(exit)`
58 ---
60 void test2456a()
62 scope(success)
64 scope(success) {} // NG
65 scope(failure) {} // NG
66 scope(exit) {} // OK
69 scope(failure)
71 scope(success) {} // OK
72 scope(failure) {} // OK
73 scope(exit) {} // OK
76 scope(exit)
78 scope(success) {} // NG
79 scope(failure) {} // NG
80 scope(exit) {} // OK
85 TEST_OUTPUT:
86 ---
87 fail_compilation/fail2456.d(96): Error: cannot put `catch` statement inside `scope(success)`
88 fail_compilation/fail2456.d(108): Error: cannot put `catch` statement inside `scope(exit)`
89 ---
91 void test2456b()
93 scope(success)
95 try {}
96 catch (Throwable) {} // NG
99 scope(failure)
101 try {}
102 catch (Throwable) {} // OK
105 scope(exit)
107 try {}
108 catch (Throwable) {} // NG
113 TEST_OUTPUT:
115 fail_compilation/fail2456.d(121): Deprecation: can only catch mutable or const qualified types, not `immutable(Exception)`
118 void main() {
119 try {
120 throw new Exception("");
121 } catch (immutable Exception e) {
122 assert(0);