Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/goto_skip.d

raw
1 /*
2 REQUIRED_ARGS: -verrors=context
3 TEST_OUTPUT:
4 ---
5 fail_compilation/goto_skip.d(28): Error: `goto` skips declaration of variable `goto_skip.skip.ch`
6 goto Lskip;
7 ^
8 fail_compilation/goto_skip.d(29): declared here
9 char ch = '!';
10 ^
11 fail_compilation/goto_skip.d(36): Error: `goto` skips declaration of `with` temporary
12 goto L1;
13 ^
14 fail_compilation/goto_skip.d(38): declared here
15 with (S()) {
16 ^
17 fail_compilation/goto_skip.d(46): Error: `goto` skips declaration of variable `goto_skip.test8.e`
18 goto L2;
19 ^
20 fail_compilation/goto_skip.d(51): declared here
21 catch (Exception e) {
22 ^
23 ---
24 */
25 char skip(bool b)
26 {
27 if (b)
28 goto Lskip;
29 char ch = '!';
30 Lskip:
31 return ch;
32 }
33
34 int f()
35 {
36 goto L1;
37 struct S { int e = 5; }
38 with (S()) {
39 L1:
40 return e;
41 }
42 }
43
44 void test8(int a)
45 {
46 goto L2;
47
48 try {
49 a += 2;
50 }
51 catch (Exception e) {
52 a += 3;
53 L2: ;
54 a += 100;
55 }
56 assert(a == 100);
57 }