[Issue 9132] New: Unhelpful error message when calling non-const property from const method.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 10 01:14:47 PST 2012


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

           Summary: Unhelpful error message when calling non-const
                    property from const method.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bugzilla at kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2012-12-10 01:14:45 PST ---
Test case:

    struct S
    {
        @property int foo() { return 123; }
        void bar() const { foo; }
    }

DMD produces the following error message, which is not very useful:

    bug.d(4): Error: function a.S.foo () is not callable
    using argument types ()

Note that if parentheses are added to the foo() call, the error changes to:

    bug.d(4): Error: function bug.S.foo () is not callable
    using argument types () const

which is much better.

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