https://issues.dlang.org/show_bug.cgi?id=16245

          Issue ID: 16245
           Summary: the message emitted when a const function mutates
                    members is misleading
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

For

struct Foo
{
    int i;
    void foo() const{i = 1;}
}

DMD outputs

> Error: cannot modify immutable expression this.i

which can be interpreted as "i is const".
The error message should rather be

"Error: cannot modify %s in const function"

--

Reply via email to