[Issue 10511] New: Unhelpful error messages with a const opDispatch

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 30 07:52:38 PDT 2013


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

           Summary: Unhelpful error messages with a const opDispatch
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-30 07:52:37 PDT ---
Modified from code by David in D.learn. This is wrong code:


struct Foo {
    static Foo opDispatch(string s)() const {
        return Foo();
    }
}
void main() {
    Foo f = Foo.bar();
}



DMD 2.064alpha gives:

test.d(7): Error: no property 'bar' for type 'Foo'
test.d(7): Error: Foo is not an expression


The error messages don't help much because they don't explain what's the
problem. The code able to compile is without "const":


struct Foo {
    static Foo opDispatch(string s)() {
        return Foo();
    }
}
void main() {
    Foo f = Foo.bar();
}

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