Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag9358.d(13): Error: `x` must be of integral or string type, it is a `double`
5 fail_compilation/diag9358.d(15): Error: `case` expression must be a compile-time `string` or an integral constant, not `1.1`
6 fail_compilation/diag9358.d(16): Error: `case` expression must be a compile-time `string` or an integral constant, not `2.1`
7 fail_compilation/diag9358.d(26): Error: `case` expression must be a compile-time `string` or an integral constant, not `z`
8 ---
9 */
10 void main()
11 {
12 double x;
13 switch (x)
14 {
15 case 1.1: break;
16 case 2.1: break;
17 default:
18 }
19 }
20
21 void f(immutable string y)
22 {
23 auto z = y[0..2];
24 switch (y)
25 {
26 case z: break;
27 default:
28 }
29 }