File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -359,18 +359,26 @@ $(H2 $(LNAME2 array-copying, Array Copying))
359
359
right-hand side is an array of or pointer to the same type.
360
360
)
361
361
362
- $(SPEC_RUNNABLE_EXAMPLE_FAIL
362
+ $(SPEC_RUNNABLE_EXAMPLE_RUN
363
363
---------
364
- int[3] s;
365
- int[3] t ;
364
+ int[3] s, t ;
365
+ int[] a ;
366
366
367
367
s = t; // the 3 elements of t are copied into s
368
368
s[] = t; // the 3 elements of t are copied into s
369
369
s[] = t[]; // the 3 elements of t are copied into s
370
370
s[1..2] = t[0..1]; // same as s[1] = t[0]
371
371
s[0..2] = t[1..3]; // same as s[0] = t[1], s[1] = t[2]
372
- s[0..4] = t[0..4]; // error, only 3 elements in s
373
- s[0..2] = t; // error, operands have different lengths
372
+ //s[0..4] = t[0..4]; // error, only 3 elements in s and t
373
+ //s[0..2] = t; // error, operands have different lengths
374
+
375
+ a = [1, 2];
376
+ s[0..2] = a;
377
+ assert(s == [1, 2, 0]);
378
+
379
+ //a[] = s; // RangeError, lengths don't match
380
+ a[0..2] = s[1..3];
381
+ assert(a == [2, 0]);
374
382
---------
375
383
)
376
384
You can’t perform that action at this time.
0 commit comments