Auto keyword with const variable

Alex H myemail at email.com
Wed Jul 24 01:07:54 PDT 2013


This code:

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.


More information about the Digitalmars-d-learn mailing list