The docs say the result is an lvalue for:
> cast(U) expressions applied to lvalues of type T when T* is implicitly convertible to U*;
https://dlang.org/spec/expression.html#.define-lvalue
const int* does not implicitly convert to int*, yet:
void main()
{
const int i;
cast(int) i = 2;
assert(i == 0); // passes
}
The cast is making a hidden copy, which should be an rvalue. So the assignment should error.
Comment #1 by robert.schadek — 2024-12-13T19:33:58Z