www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4947] New: Not easy to understand error message with pure and const

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4947

           Summary: Not easy to understand error message with pure and
                    const
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-09-26 10:46:23 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4947


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

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-27
18:03:35 PST ---
Test case works in 2.060+. As for the const error message, this is another case
of Issue 1730.

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
         Resolution|FIXED                       |WORKSFORME


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2012-12-27
21:09:07 PST ---
Please don't mark as "FIXED" things that were fixed elsewhere, and do not
include a link to the git change.

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



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-28
11:32:59 PST ---
(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 "github-bugzilla puremagic.com".
 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 28 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4947



--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2012-12-28
12:13:52 PST ---
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.

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



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-28
12:18:23 PST ---
(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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 28 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4947



--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2012-12-28
14:04:59 PST ---
(In reply to comment #5)
 Then I suggest changing this page:
 http://d.puremagic.com/issues/page.cgi?id=fields.html#status
Good idea. Brad has made the change. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 28 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4947


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Jesse.K.Phillips+D gmail.co
                   |                            |m


--- Comment #7 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-23
17:25:36 PST ---
*** Issue 5101 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2013