Bug 4216 – Class method hidden by another one warning

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-05-20T16:55:00Z
Last change time
2015-06-09T05:12:02Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-05-20T16:55:27Z
This D2 program: class A { void foo(A a) {} } class B : A { // line 4 void foo(B b) {} } void main() {} It compiles with no problems with dmd v2.046: dmd test.d But if I compile it with: dmd -w test.d I receive a compile error: test.d(4): Error: class test.B test.A.foo(A a) is hidden by B In my opinion that error message can be improved in something like this (that also informs the programmer that this error comes from the -w switch): test.d(4): Warning: class method test.A.foo(A a) is hidden by test.B.foo(B b) I presume this warning is useful because it can avoid bugs. If it is important it can become a true error, that doesn't need -w to show up (see also bug 3836 ).
Comment #1 by bearophile_hugs — 2011-07-09T10:49:05Z
DMD 2.054beta without -w prints this: test.d(4): Error: class test.B use of test.A.foo(A a) hidden by B is deprecated The error message may also suggest the use of "alias" to solve this problem.
Comment #2 by andrej.mitrovich — 2012-12-20T15:00:53Z
*** This issue has been marked as a duplicate of issue 6373 ***