[Issue 2270] cast produces invalid arrays at runtime
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 9 15:32:02 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=2270
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WORKSFORME |---
--- Comment #15 from Steven Schveighoffer <schveiguy at yahoo.com> ---
No, it still doesn't work right. The example wasn't complete. Essentially, the
cast shouldn't compile.
https://run.dlang.io/is/8Hihr0
Note that I would expect the call to foo to produce output, but it doesn't.
If I add in a printout of the class and interface addresses, you get identical
addresses. That is, the cast didn't perform the thunk to get to the actual
interface record. Which would be expected (a correct cast would have to
reallocate the array).
I think the correct thing to do here is require a reinterpret cast if you
really want this cast to succeed (cast to void * and back).
--
More information about the Digitalmars-d-bugs
mailing list