1 /* 2 TEST_OUTPUT: 3 --- 4 fail_compilation/ctfe11467.d(15): Error: overlapping slice assignment [0..4] = [1..5] 5 fail_compilation/ctfe11467.d(24): called from here: test11467a() 6 fail_compilation/ctfe11467.d(24): while evaluating: `static assert(test11467a())` 7 fail_compilation/ctfe11467.d(21): Error: overlapping slice assignment [1..5] = [0..4] 8 fail_compilation/ctfe11467.d(25): called from here: test11467b() 9 fail_compilation/ctfe11467.d(25): while evaluating: `static assert(test11467b())` 10 --- 11 */ test11467a()12int test11467a() 13 { 14 auto a = [0, 1, 2, 3, 4]; 15 a[0 .. 4] = a[1 .. 5]; 16 return 1; 17 } test11467b()18int test11467b() 19 { 20 auto a = [0, 1, 2, 3, 4]; 21 a[1 .. 5] = a[0 .. 4]; 22 return 1; 23 } 24 static assert(test11467a()); 25 static assert(test11467b()); 26 27 /* 28 TEST_OUTPUT: 29 --- 30 fail_compilation/ctfe11467.d(41): Error: overlapping slice assignment [0..4] = [1..5] 31 fail_compilation/ctfe11467.d(50): called from here: test11467c() 32 fail_compilation/ctfe11467.d(50): while evaluating: `static assert(test11467c())` 33 fail_compilation/ctfe11467.d(47): Error: overlapping slice assignment [1..5] = [0..4] 34 fail_compilation/ctfe11467.d(51): called from here: test11467d() 35 fail_compilation/ctfe11467.d(51): while evaluating: `static assert(test11467d())` 36 --- 37 */ test11467c()38int test11467c() 39 { 40 auto a = "abcde".dup; 41 a[0 .. 4] = a[1 .. 5]; 42 return 1; 43 } test11467d()44int test11467d() 45 { 46 auto a = "abcde".dup; 47 a[1 .. 5] = a[0 .. 4]; 48 return 1; 49 } 50 static assert(test11467c()); 51 static assert(test11467d()); 52 53