MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail22881.d
blob31195f6c7a5780b89ca223da99366380d3484d6f
1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/fail22881.d(101): Error: pointer slice `[0..6]` exceeds allocated memory block `[0..5]`
4 fail_compilation/fail22881.d(102): Error: pointer slice `[0..6]` exceeds allocated memory block `[0..5]`
5 fail_compilation/fail22881.d(110): Error: pointer slice `[3..5]` exceeds allocated memory block `[0..4]`
6 fail_compilation/fail22881.d(113): called from here: `ptr22881()`
7 fail_compilation/fail22881.d(113): while evaluating: `static assert(ptr22881())`
8 fail_compilation/fail22881.d(203): Error: slice `[0..2]` is out of bounds
9 fail_compilation/fail22881.d(207): called from here: `null22881()`
10 fail_compilation/fail22881.d(207): while evaluating: `static assert(null22881())`
11 fail_compilation/fail22881.d(305): Error: slice `[2..4]` exceeds array bounds `[0..3]`
12 fail_compilation/fail22881.d(308): called from here: `slice22881()`
13 fail_compilation/fail22881.d(308): while evaluating: `static assert(slice22881())`
14 fail_compilation/fail22881.d(401): Error: slice `[0..1]` exceeds array bounds `[0..0]`
15 fail_compilation/fail22881.d(403): Error: slice `[0..1]` exceeds array bounds `[0..0]`
16 ---
18 #line 100
19 // SliceExp: e1.type.ty == pointer
20 static pstr22881 = "hello".ptr[0 .. 6];
21 static parr22881 = ['h','e','l','l','o'].ptr[0 .. 6];
23 bool ptr22881()
25 char *p1 = new char[4].ptr;
26 p1[0 .. 4] = "str\0";
27 char *s1 = p1[1 .. 3].ptr;
28 char *s2 = s1[1 .. 3].ptr; // = p1[2 .. 4]
29 char *s3 = s2[1 .. 3].ptr; // = p1[3 .. 5]
30 return true;
32 static assert(ptr22881());
35 #line 200
36 // SliceExp: e1.op == null
37 bool null22881()
39 string[][1] nullexp;
40 nullexp[0][0 .. 2] = "st";
41 return true;
43 static assert(null22881());
45 #line 300
46 // SliceExp: e1.op == slice
47 bool slice22881()
49 char[] str = "abcd".dup;
50 char[] slice = str[1 .. 4];
51 slice[2 .. 4] = "ab";
52 return true;
54 static assert(slice22881());
56 #line 400
57 // SliceExp: e1.op == arrayLiteral
58 static arr22881 = [][0 .. 1];
59 // SliceExp: e1.op == string_
60 static str22881 = ""[0 .. 1];