[Issue 13697] New: Private method hides public static method

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Nov 7 06:21:01 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13697

          Issue ID: 13697
           Summary: Private method hides public static method
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andre at s-e-a-p.de

Following code fails with errors:
class test.A member b is not accessible

module app;
import test;

void main()
{
    A.b("");
}

module test;

class A
{
    private void b(){}
    static void b(string b){}
}

Comment from Jonathan M Davis (forum):

That looks like a bug. All you have to do is change the order of the two
function declarations or rename the non-static one to something else, and it
compiles. So, somehow, the fact that the non-static one has the same name as
the static one and the fact that it comes first screws up accessing the
static one. And explicitly marking the static one as public doesn't help.

--


More information about the Digitalmars-d-bugs mailing list