https://issues.dlang.org/show_bug.cgi?id=24388
Issue ID: 24388
Summary: Private overload of public function can be called from
other modules
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
As of DMD 2.107.0, the following program compiles and runs without errors:
--- lib.d
module lib;
import std.stdio;
private void fun(int) { writeln("int"); }
public void fun(string) { writeln("string"); }
--- app.d
module app;
import lib;
void main()
{
int n;
fun(n);
}
---
The output is:
---
int
---
Even thought lib.fun(int) is private, it is able to be called from the app
module as long as lib.fun(string) is public.
Unlike in issue 23947, the order of the lib.fun overloads does not matter here.
--