[Issue 15704] @safe code should not allow copying to/from void[]
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jun 14 08:26:44 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15704
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to hsteoh from comment #2)
> It's not just writing to void[] that's the problem. Consider:
>
> ----
> int[] intArr = [ 1,2,3,4,5 ];
> void[] voidArr = intArr; // OK, every array converts to void[]
> int*[] ptrArr;
> ptrArr.length = 5;
> ptrArr[] = voidArr[]; // reinterpret intArr as pointers
Wait, does this really work (I didn't think it did)? If so, isn't it still
implicitly doing this:
(cast(void[])ptrArr)[] = voidArr[];
Which is still writing void data.
--
More information about the Digitalmars-d-bugs
mailing list