[Issue 4947] New: Not easy to understand error message with pure and const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 26 10:47:06 PDT 2010


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

           Summary: Not easy to understand error message with pure and
                    const
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-09-26 10:46:23 PDT ---
This is a wrong D2 program:


struct Foo(int x) {
    pure /*const*/ void bar() {}
}
pure void spam(int X)(Foo!X arr) {
    arr.bar();
}
void main() {
    Foo!5 f;
    spam(f);
}



DMD 2.049 gives not easy to understand error messages:
test.d(5): Error: function test.Foo!(5).Foo.bar () is not callable using
argument types () const
test.d(9): Error: template instance test.spam!(5) error instantiating

Foo.bar() is pure, but this is not enough, to compile this code bar() also
needs to be const. I'd like dmd to give a more readable error message, that
suggests how to fix the code.

-- 
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