News and problems about foreach loops

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Nov 3 07:42:22 PDT 2012


On 11/3/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> It should be something like "cannot modify const member x".

In fact the error is already read but the else statement is not taken
in Expression::checkModifiable:

    if (var && var->storage_class & STCctorinit)  // goes here
    {
        const char *p = var->isStatic() ? "static " : "";
        error("can only initialize %sconst member %s inside %sconstructor",
            p, var->toChars(), p);
    }
    else
    {
        OutBuffer buf;
        MODtoBuffer(&buf, type->mod);
        error("cannot modify %s expression %s", buf.toChars(), toChars());
    }


More information about the Digitalmars-d mailing list