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