Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=21849
2 // REQUIRED_ARGS: -verrors=context -vcolumns
3 /* TEST_OUTPUT:
4 ---
5 fail_compilation/fail21849.d(21,17): Error: cannot implicitly convert expression `1` of type `int` to `string`
6 string ß = 1;
7 ^
8 fail_compilation/fail21849.d(25,42): Error: cannot implicitly convert expression `cast(ushort)65535u` of type `ushort` to `byte`
9 string s = "ß☺-oneline"; byte S = ushort.max;
10 ^
11 fail_compilation/fail21849.d(30,10): Error: undefined identifier `undefined_identifier`
12 ß-utf"; undefined_identifier;
13 ^
14 fail_compilation/fail21849.d(35,15): Error: `s[0..9]` has no effect
15 ☺-smiley"; s[0 .. 9];
16 ^
17 ---
18 */
19 void fail21849a()
20 {
21 string ß = 1;
22 }
23 void fail21849b()
24 {
25 string s = "ß☺-oneline"; byte S = ushort.max;
26 }
27 void fail21849c()
28 {
29 string s = "
30 ß-utf"; undefined_identifier;
31 }
32
33 // Test correct context with line directive present
34 // https://github.com/dlang/dmd/issues/20929
35 #line 32
36 void fail21849d()
37 {
38 string s = "
39 ☺-smiley"; s[0 .. 9];
40 }