Bug 4947 – Not easy to understand error message with pure and const
Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-09-26T10:46:00Z
Last change time
2013-01-23T17:25:36Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2010-09-26T10:46:23Z
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.
Comment #1 by andrej.mitrovich — 2012-12-27T18:03:35Z
Test case works in 2.060+. As for the const error message, this is another case of Issue 1730.
Comment #2 by bugzilla — 2012-12-27T21:09:07Z
Please don't mark as "FIXED" things that were fixed elsewhere, and do not include a link to the git change.
Comment #3 by andrej.mitrovich — 2012-12-28T11:32:59Z
(In reply to comment #2)
> Please don't mark as "FIXED" things that were fixed elsewhere,
But it's fixed. WORKSFORME should be used for test-cases which can't be reproduced. This is a reproducible test-case in DMD 2.049. See: http://d.puremagic.com/issues/page.cgi?id=fields.html#status
I know why you're complaining, it's because you've made a simple bugzilla query and added it as a link to the changelog and this issue pops up on the list.
You can make a better query by setting "a commenter", selecting "contains" and putting in "[email protected]".
> and do not include a link to the git change.
Where did I include such a link? I included a link to another bug report.
Comment #4 by bugzilla — 2012-12-28T12:13:52Z
Yes, you're right, the reason for this is in order to have a clean automatically generated list of fixes for the changelog.
There's no reason to have what are essentially duplicates appear in the changelog.
Either resolve them as duplicates if the issue that fixed it can be identified, or worksforme if not.
The one marked "fixed" should be the one that was listed in the pull request and git log as being fixed by that change. There should only be one issue marked as "fixed" per bug.
Comment #5 by andrej.mitrovich — 2012-12-28T12:18:23Z
(In reply to comment #4)
> Yes, you're right, the reason for this is in order to have a clean
> automatically generated list of fixes for the changelog.
>
> There's no reason to have what are essentially duplicates appear in the
> changelog.
>
> Either resolve them as duplicates if the issue that fixed it can be identified,
> or worksforme if not.
>
> The one marked "fixed" should be the one that was listed in the pull request
> and git log as being fixed by that change. There should only be one issue
> marked as "fixed" per bug.
Then I suggest changing this page: http://d.puremagic.com/issues/page.cgi?id=fields.html#status
Few people will know about your comment here.