MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail6889.d
blobee84a84ce79336b1234d5692084eb42d6d852845
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail6889.d(16): Error: cannot `goto` out of `scope(success)` block
5 fail_compilation/fail6889.d(17): Error: cannot `goto` in to `scope(success)` block
6 fail_compilation/fail6889.d(19): Error: `return` statements cannot be in `scope(success)` bodies
7 fail_compilation/fail6889.d(23): Error: `continue` is not allowed inside `scope(success)` bodies
8 fail_compilation/fail6889.d(24): Error: `break` is not allowed inside `scope(success)` bodies
9 fail_compilation/fail6889.d(29): Error: `continue` is not allowed inside `scope(success)` bodies
10 fail_compilation/fail6889.d(30): Error: `break` is not allowed inside `scope(success)` bodies
11 ---
13 void test_success()
15 L1:
16 scope(success) { L2: goto L1; } // NG
17 goto L2; // NG
19 scope(success) { return; } // NG (from fail102.d)
21 foreach (i; 0..1)
23 scope(success) continue; // NG
24 scope(success) break; // NG
27 foreach (i; Aggr())
29 scope(success) continue; // NG
30 scope(success) break; // NG
33 // is equivalent with:
34 switch (
35 Aggr().opApply((int i){
36 scope(success) return 0; // NG
37 scope(success) return 1; // NG
38 return 0;
39 }))
41 default: break;
47 TEST_OUTPUT:
48 ---
49 fail_compilation/fail6889.d(56): Error: cannot `goto` in to `scope(failure)` block
50 ---
52 void test_failure()
54 L1:
55 scope(failure) { L2: goto L1; } // OK
56 goto L2; // NG
60 foreach (i; 0..1)
62 scope(failure) continue; // OK
63 scope(failure) break; // OK
66 foreach (i; Aggr())
68 scope(failure) continue; // OK
69 scope(failure) break; // OK
72 // is equivalent with:
73 switch (
74 Aggr().opApply((int i){
75 scope(failure) return 0; // OK
76 scope(failure) return 1; // OK
77 return 0;
78 }))
80 default: break;
86 TEST_OUTPUT:
87 ---
88 fail_compilation/fail6889.d(100): Error: cannot `goto` out of `scope(exit)` block
89 fail_compilation/fail6889.d(101): Error: cannot `goto` in to `scope(exit)` block
90 fail_compilation/fail6889.d(103): Error: `return` statements cannot be in `scope(exit)` bodies
91 fail_compilation/fail6889.d(107): Error: `continue` is not allowed inside `scope(exit)` bodies
92 fail_compilation/fail6889.d(108): Error: `break` is not allowed inside `scope(exit)` bodies
93 fail_compilation/fail6889.d(113): Error: `continue` is not allowed inside `scope(exit)` bodies
94 fail_compilation/fail6889.d(114): Error: `break` is not allowed inside `scope(exit)` bodies
95 ---
97 void test_exit()
99 L1:
100 scope(exit) { L2: goto L1; } // NG
101 goto L2; // NG
103 scope(exit) { return; } // NG (from fail102.d)
105 foreach (i; 0..1)
107 scope(exit) continue; // NG
108 scope(exit) break; // NG
111 foreach (i; Aggr())
113 scope(exit) continue; // NG
114 scope(exit) break; // NG
117 // is equivalent with:
118 switch (
119 Aggr().opApply((int i){
120 scope(exit) return 0; // NG
121 scope(exit) return 1; // NG
122 return 0;
125 default: break;
130 struct Aggr { int opApply(int delegate(int) dg) { return dg(0); } }