Debian Codegraph @

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

raw
1 /*
2 https://issues.dlang.org/show_bug.cgi?id=21739
3
4 REQUIRED_ARGS: -debug
5 TEST_OUTPUT:
6 ---
7 fail_compilation/debugCaseDeclaration.d(22): Error: undefined identifier `x`
8 fail_compilation/debugCaseDeclaration.d(33): Error: undefined identifier `y`
9 ---
10 */
11
12 void main()
13 {
14 int i, k;
15 switch (i)
16 {
17 case 0:
18 int x;
19 break;
20
21 case 1:
22 x = 1;
23 break;
24
25 case 2:
26 int y;
27 break;
28
29 debug
30 {
31 case 3:
32 k = 1; // Valid
33 y = 1; // Invalid but accepted
34 break;
35 }
36
37 default:
38 }
39 }