Skip to content

Commit e9e4536

Browse files
committed
Tweak SA assign docs
Fixes Issue 23325 - Assigning dynamic array to static array not documented
1 parent e620bc7 commit e9e4536

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spec/arrays.dd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ assert(a == []);
199199
using pointer $(RELATIVE_LINK2 slicing, slicing), so that the number of elements
200200
to copy is then known.)
201201

202-
$(P A static array can be assigned from a dynamic array. The lengths must match:)
202+
$(P A static array can be assigned from a dynamic array - the data is copied.
203+
The lengths must match:)
203204

204205
$(SPEC_RUNNABLE_EXAMPLE_RUN
205206
---
@@ -212,10 +213,12 @@ s = [1, 2, 3]; // OK
212213

213214
a = [4, 5, 6];
214215
s = a; // OK
216+
assert(s.ptr != a.ptr);
215217
a = [1, 2];
216-
//s = a; // RangeError
218+
//s = a; // RangeError, length mismatch
217219

218220
a = s;
221+
assert(a.ptr == s.ptr);
219222
//s = a; // RangeError, overlap
220223
---
221224
)

0 commit comments

Comments
 (0)