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]`
19 // SliceExp: e1.type.ty == pointer
20 static pstr22881
= "hello".ptr
[0 .. 6];
21 static parr22881
= ['h','e','l','l','o'].ptr
[0 .. 6];
25 char *p1
= new char[4].ptr
;
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]
32 static assert(ptr22881());
36 // SliceExp: e1.op == null
40 nullexp
[0][0 .. 2] = "st";
43 static assert(null22881());
46 // SliceExp: e1.op == slice
49 char[] str = "abcd".dup
;
50 char[] slice
= str[1 .. 4];
54 static assert(slice22881());
57 // SliceExp: e1.op == arrayLiteral
58 static arr22881
= [][0 .. 1];
59 // SliceExp: e1.op == string_
60 static str22881
= ""[0 .. 1];