Thread overview
[Issue 9422] New: Missed redundancy of method const error
Jan 29, 2013
Tommi
January 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9422

           Summary: Missed redundancy of method const error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2013-01-29 01:08:19 PST ---
From this thread: http://forum.dlang.org/thread/dqoeyvvzyuuvvkiqdbtv@forum.dlang.org


class Foo {
    int[] array;
    const int[] bar() const {
        return array;
    }
}
void main() {}



DMD 2.062alpha gives:

test.d(4): Error: cannot implicitly convert expression (this.array) of type
const(int[]) to int[]


But I'd like a more clear error message like:

test.d(3): Error: redundant qualifier const on class method Foo.bar

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9422



--- Comment #1 from bearophile_hugs@eml.cc 2013-01-29 01:43:33 PST ---
See also closed Issue 4070

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9422


Tommi <tommitissari@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tommitissari@hotmail.com


--- Comment #2 from Tommi <tommitissari@hotmail.com> 2013-01-29 02:24:54 PST ---
(In reply to comment #0)
> test.d(3): Error: redundant qualifier const on class method Foo.bar

I think this would be clearer wording:

test.d(3): Error: more than one const qualifier on class method Foo.bar

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