[Issue 4216] New: Class method hidden by another one warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 20 16:55:29 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4216

           Summary: Class method hidden by another one warning
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-05-20 16:55:27 PDT ---
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
).

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


More information about the Digitalmars-d-bugs mailing list