D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9422 - Missed redundancy of method const error
Summary: Missed redundancy of method const error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 minor
Assignee: No Owner
URL:
Keywords: diagnostic, pull
Depends on:
Blocks:
 
Reported: 2013-01-29 01:08 UTC by bearophile_hugs
Modified: 2022-09-08 14:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2013-01-29 01:08:19 UTC
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
Comment 1 bearophile_hugs 2013-01-29 01:43:33 UTC
See also closed Issue 4070
Comment 2 Tommi 2013-01-29 02:24:54 UTC
(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