www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4216] New: Class method hidden by another one warning

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
May 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4216




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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4216


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

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



15:00:53 PST ---
*** This issue has been marked as a duplicate of issue 6373 ***

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