mutable constant?
Namespace
rswhite4 at googlemail.com
Wed Jun 26 22:58:25 PDT 2013
> You're right. I didn't read over the OP's example carefully
> enough. The
> mutation is being done to a module-level variable in an inout
> function, which
> is completely legit. I thought that what the OP thought was
> wrong was mutating
> a module-level variable in a non-mutable function (and that's
> perfectly fine as
> long as it's not pure). What I missed (and you didn't) was the
> fact that that
> module-level variable was pointing to the contents of the
> object which was
> const. And that mutable pointer _is_ being obtained via the
> constructor just
> like in your example. And that is most definitely a compiler
> bug - the same one
> that your example shows.
>
> - Jonathan M Davis
That was exactly my question.
More information about the Digitalmars-d-learn
mailing list