[Issue 24793] Allow implicit conversion of const pointers to void*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 21 02:19:48 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24793

--- Comment #3 from Dennis <dkorpel at live.nl> ---
(In reply to Jonathan M Davis from comment #2)
> Also, at present, the implicit conversion from a mutable pointer to void* is
> considered @safe - e.g.
> 
> ---
> void main() @safe
> {
>     int* i;
>     void* v = i;
> }
> ---
> 
> whereas it would be completely inappropriate to consider it memory safe if
> const is implicitly removed in the process. So, even if we did add such an
> implicit conversion, it would need to be @system.

No it wouldn't, unless you can actually demonstrate how it would result in
memory corruption.

--


More information about the Digitalmars-d-bugs mailing list