[Issue 16245] New: the message emitted when a const function mutates members is misleading
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 7 00:50:50 PDT 2016
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: nobody at puremagic.com
Reporter: b2.temp at gmx.com
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"
--
More information about the Digitalmars-d-bugs
mailing list