Bug 6981 – incorrect error message when calling method without parentheses
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-20T13:48:00Z
Last change time
2012-12-27T17:50:19Z
Keywords
diagnostic
Assigned to
nobody
Creator
hoganmeier
Comments
Comment #0 by hoganmeier — 2011-11-20T13:48:56Z
class Document
{
const
override hash_t toHash()
{
return super.toHash;
}
}
Error: function object.Object.toHash () is not callable using argument types ()
If you change it into 'return super.toHash();' then it prints
Error: function object.Object.toHash () is not callable using argument types () const
OT: I really wish that horrible error message would be turned into something more easily understandable like 'function can't be called on a const instance' or whatever.
Comment #1 by hoganmeier — 2011-11-20T13:57:30Z
Actually I think it shouldn't even get to that point.
Shouldn't it complain about toHash not overriding a base method?
The above error message isn't helpful at all, especially if the const isn't applied to the function directly but through a 'const: /*many functions*/'.
Comment #2 by andrej.mitrovich — 2012-12-27T17:50:19Z
Now it's:
Error: not a property super.toHash
After adding parens:
Error: function object.Object.toHash () is not callable using argument types () const
After Issue 1730 is fixed the error message will improve.
*** This issue has been marked as a duplicate of issue 1730 ***