www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bugzilla kyllingen.net



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: -------
Dec 10 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9132




01:18:12 PST ---
Please disregard the "a.S.foo" in the first error message, which is not part of
the problem.  It is simply a result of me renaming the source file and only
copy-pasting part of the message anew. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9132


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



08:57:38 PST ---
*** This issue has been marked as a duplicate of issue 6707 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9132




08:58:41 PST ---
Note that in upcoming 2.061 this error is now shown for calls with or without
parens, so it's slightly more descriptive:

Error: function test.S.foo () is not callable using argument types () const

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