Bug 13697 – Private method hides public static method
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2014-11-07T14:21:01Z
Last change time
2018-02-22T13:55:13Z
Assigned to
No Owner
Creator
Andre
Comments
Comment #0 by andre — 2014-11-07T14:21:01Z
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.
Comment #1 by razvan.nitu1305 — 2018-02-22T13:55:13Z