[Issue 6707] Error message for mismatch of const/non-const property functions needs to improve

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 21 14:09:56 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6707


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
           Severity|normal                      |enhancement


--- Comment #4 from bearophile_hugs at eml.cc 2012-10-21 14:09:55 PDT ---
I reopen this as enhancement request because I think the error message is not
good enough still. See Issue 8549 for more info.

This program:


struct Foo {
    int[] opSlice() {
        return [0];
    }
}
struct Bar {
    Foo spam;
    const(Foo) bar() const { return spam; }
}
void main() {
    Bar().bar()[];
}


Currently gives:

test.d(11): Error: function test.Foo.opSlice () is not callable using argument
types () const


In Issue 8549 Andrej Mitrovic suggests an error message similar to:

Error: function test.Foo.opSlice () is not callable using const(this)


But I think a better error message, more newbie-friendly, tells the programmer
how to fix the problem, (not complete error message):

test.d(11): Error: function test.Foo.opSlice() needs to be const to [...]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list