Debian Codegraph @

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

raw
1 /*
2 * REQUIRED_ARGS: -de
3 * TEST_OUTPUT:
4 ---
5 fail_compilation/skip.d(23): Error: `switch` skips declaration of `with` temporary
6 fail_compilation/skip.d(28): declared here
7 fail_compilation/skip.d(45): Error: `switch` skips declaration of variable `skip.test14532.n`
8 fail_compilation/skip.d(47): declared here
9 ---
10 */
11 // https://issues.dlang.org/show_bug.cgi?id=10524
12
13 struct S
14 {
15 int field;
16 }
17
18 void test10524()
19 {
20 int a = 1;
21 S struct_with_long_name;
22
23 switch( a )
24 {
25 case 0:
26 struct_with_long_name.field = 444; // ok
27 break;
28 with( struct_with_long_name )
29 {
30 case 1:
31 field = 555; // segfault
32 break;
33 }
34
35 default:
36 break;
37 }
38 }
39
40 // https://issues.dlang.org/show_bug.cgi?id=14532
41
42 void test14532()
43 {
44 char ch = '!';
45 switch (ch)
46 {
47 int n = 42;
48 case '!':
49 assert(n == 42);
50 break;
51
52 default:
53 }
54 }