[Issue 19754] cast() sometimes yields lvalue, sometimes yields rvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 23 15:47:55 UTC 2019


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

--- Comment #4 from Andrei Alexandrescu <andrei at erdani.com> ---
Mathias, the reason for which we want cast() and cast(shared) to compile has to
do with a DIP in the works on __mutable. That would require inserting a manual
cast (either cast() or cast(shared)) when the compiler is unable to assess
whether the data originated as unqualified or immutable.

Yes, we could take the address and cast it but it's more difficult to specify
and verify that two operations must be done in immediate sequence, as opposed
to one operation. I think there may be a few cases in which two successive
operations are semantically checked together but wouldn't want to add to those.

--


More information about the Digitalmars-d-bugs mailing list