DMD 1.004 release

Derek Parnell derek at psych.ward
Sat Jan 27 18:31:33 PST 2007


On Sat, 27 Jan 2007 16:35:23 -0500, Jordan Miner wrote:

> Here is a problem I've found in post-1.00 versions.
> I have this unittest in my library:
> 
> unittest {
> 	char[] c = "Computer";
> 	ArrayCopy!(char)(c, 3, c, 2, 4);
> 	assert(c == "Coputeer");
> 	c = "Computer";
> 	ArrayCopy!(char)(c, 2, c, 3, 4);
> 	assert(c == "Commputr");
> }

Does this work for you?

 unittest {
 	char[] c = "Computer".dup; // Take a copy of the string literal.
 	ArrayCopy!(char)(c, 3, c, 2, 4);
 	assert(c == "Coputeer");
 	c = "Computer";
 	ArrayCopy!(char)(c, 2, c, 3, 4);
 	assert(c == "Commputr");
 }


I suspect that you are trying to (inadvertantly) modify a string literal.

-- 
Derek Parnell



More information about the Digitalmars-d-announce mailing list