On Tuesday, 14 November 2023 at 16:51:07 UTC, Paul Backus wrote:
There's no assignment. The value is constructed in-place, in
`ss2`'s memory.
The reason the compiler allows you to construct a `const(S2)`
value inside of an `S2` variable is that `const(S2)` implicitly
converts to `S2`.
On Tuesday, 14 November 2023 at 16:58:25 UTC, Steven
Schveighoffer wrote:
That being said, I still consider this a bug, if the inout
version works, the const version should work as well. I don't
see the difference.
Ok so to summarize:
- "inout" and "const" behaving differently here is probably
wrong, and
- in structs without reference fields, a const constructor can be
used to construct mutable values, due to "implicit qualifier
conversions".
Thanks.