Auto keyword with const variable
bearophile
bearophileHUGS at lycos.com
Wed Jul 24 02:39:48 PDT 2013
Alex H:
> void test(const int n)
> {
> auto j = n;
> j++;
> }
>
> Gives this error:
> cannot modify const expression j
>
>
> Is this considered a feature or a bug? I would assume most
> people wouldn't want new variables inheriting const.
It's a bit annoying. I don't remember people discussing this
small problem. I don't know if it's easy to "fix" it and what
side effects such change could cause.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list