[Issue 663] New: Slice assignment does not bounds check when it should
Thomas Kuehne
thomas-dloop at kuehne.cn
Sun Dec 10 09:01:03 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail at puremagic.com schrieb am 2006-12-07:
> http://d.puremagic.com/issues/show_bug.cgi?id=663
> This code compiles and executes:
>
> auto test = new char [2];
>
> test [] = 'a';
> test = test [0 .. 1];
> test [0 .. 2] = 'b'; // this line should assert
> writef ("%s\n", test.ptr [0 .. 2]);
>
> And produces the string "bb"; at the very least it should be "ba". DMD should
> throw an assertion failure at runtime on the marked line when -release mode is
> not specified.
Added to DStress as
http://dstress.kuehne.cn/norun/o/opSliceAssign_04_A.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFFfDkKLK5blCcjpWoRAnW6AKCYm8biE6n3M/mohIMA9x6sqMVvygCeJobM
tNhnm9JW7n00U+vQLjoxaj0=
=6xa1
-----END PGP SIGNATURE-----
More information about the Digitalmars-d-bugs
mailing list